Nubescope / react-native-facebook-account-kit

Facebook Account Kit SDK wrapper for React Native
321 stars 120 forks source link

.getCurrentAccount() show error #36

Closed creativefull closed 5 years ago

creativefull commented 8 years ago

hi, i'm trying like a tutorial but i got error like this

Possible Unhandled Promise Rejection (id: 0):
Server generated an error
Error: Server generated an error
    at createErrorFromErrorData (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7452:11)
    at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7403:11
    at MessageQueue.__invokeCallback (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7266:10)
    at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7138:8
    at guard (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7076:1)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:7137:1)
    at DedicatedWorkerGlobalScope.onmessage (http://localhost:8081/debuggerWorker.js:39:56)

my code

    componentWillMount() {
        AccountKit.configure({
            defaultCountry : 'ID'
        });
        AccountKit.getCurrentAccessToken().then(
            (token) => {
                if (!token) {
                    AppRegistry.runApplication('login', {
                        initialProps : {},
                        rootTag : 1
                    });
                }
                else {
                    AccountKit.getCurrentAccount().then(
                        (account) => {
                            console.log("Current Account ", account);
                        }).catch(function(error) {
                            console.log('There has been a problem with your fetch operation: ' + error.message);
                            // ADD THIS THROW error
                            throw error;
                        });
                }
        }).catch((error) => {
            console.log(error.message);
            throw error;
        });
    }

is there anything I missed in the code section? please help me :(

gaguirre commented 8 years ago

Are you sure the error is thrown by getCurrentAccount method? Could you try isolating the code?

Thanks!

creativefull commented 8 years ago

what it means isolating code?

sorry i'm newbie

gaguirre commented 8 years ago

I meant removing all code that isn't related to Account Kit specifically. Have you tried running the sample?

creativefull commented 8 years ago

sample code or sample app ?

gaguirre commented 8 years ago

This project's sample. You can follow this steps.

creativefull commented 8 years ago

yes, i've been follow that steps, but still not working for me ,.

my phone using lollipop,

creativefull commented 8 years ago

successful for login phone,. but after login i did'nt got account :(

arhmnsh commented 8 years ago

+1 Facing the exact same issue on Android. Works fine on iOS. Sample app works fine. So, removed all my custom code, and copy-pasted code from the sample. Still getting this error on getCurrentAccount().

gaguirre commented 8 years ago

Which version of React Native are you using guys? @creativefull @arhmnsh Did you configure the project with your credentials?

arhmnsh commented 8 years ago

RN is 0.32. And yep, I configured it properly.

On Fri, Sep 9, 2016, 4:42 PM Gonzalo Aguirre notifications@github.com wrote:

Which version of React Native are you using guys? @creativefull https://github.com/creativefull @arhmnsh https://github.com/arhmnsh Did you configure the project https://github.com/underscopeio/react-native-facebook-account-kit#configuration with your credentials?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/underscopeio/react-native-facebook-account-kit/issues/36#issuecomment-245916393, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTPDGli-prnoea3NuHL4F__HV8R6pNpks5qoWJUgaJpZM4Ju3Uk .

creativefull commented 8 years ago

+1 waiting for fix in android

gaguirre commented 8 years ago

Ok, thank you guys, I'll debug it later. It's probably related to the RN version.

arhmnsh commented 8 years ago

Hi @gaguirre Is there any update on this? Thanks! :)

gaguirre commented 8 years ago

I just published a new release (0.5.0) compatible with React Native 0.33. Would you try it and see if it fixes the error?

Notice that, from now on, there are two separated examples for RN 0.24 and RN 0.33.

creativefull commented 8 years ago

ok i'll try again ,. thanks

arhmnsh commented 8 years ago

Hey @gaguirre and @creativefull, Thanks for the update buddy. That didn't work. But I think I found the issue. I went the though the sample app code, found some differences in strings.xml and AppManifest.xml.

strings.xml:

screen shot 2016-09-20 at 2 53 54 pm

AndroidManifest.xml:

screen shot 2016-09-20 at 2 54 17 pm

So I took the changes from the sample, applied it in my project and it worked.

Hope it helps.

arhmnsh commented 8 years ago

Oops nope! It just worked for a couple of times. Facing the same issue again now πŸ˜•

gaguirre commented 8 years ago

I can't reproduce the error. Try with the example. If it works fine then the error must be something in your project.

arhmnsh commented 8 years ago

@gaguirre Example works perfectly. Just tried to create a new 0.33-based project, worked fine for a couple of runs, and then the same issue. :(

gaguirre commented 8 years ago

@arhmnsh could you post the error stacktrace? or share a repo with the project?

arhmnsh commented 8 years ago

@gaguirre I created this project just with accountKit. Here it is: https://gitlab.com/arhmnsh/fbakTest/blob/master/README.md

arhmnsh commented 8 years ago

Hi @gaguirre, you had any chance of checking out the repo?

gaguirre commented 8 years ago

I'm looking at it right now. A new version of Android SDK was released these days so I'll upgrade it and let you know.

gaguirre commented 8 years ago

@arhmnsh with a deeper debug I can tell your error is related to a configuration on the FB admin page. Try with the answer to this stackoverflow question and tell me if that works :)

I'll improve the error handling to show better error messages.

Andreyco commented 7 years ago

@gaguirre while the advice on SO works, it deserves more than hotfix. Is there any plan, how to properly solve this issue? TY

gaguirre commented 7 years ago

I'm not sure 100% but I think sending the app_proof is not supported by the SDK. However, that could have changed or I could be wrong, so if anyone find another better solution would be great!

Andreyco commented 7 years ago

As I recall, there is no newer SDK version. I suppose, we should wait then...

The only thing we should do is to update docs and mark "Require App Secret" should be set to "NO" in AccountKit admin panel.

gaguirre commented 7 years ago

Good idea @Andreyco. Feel free to send a PR for this too ;) Thanks for contributing!!

creativefull commented 7 years ago

Thanks @Andreyco it is work fine :+1:

edo1493 commented 7 years ago

Hello, I am on the latest version and RN 0.48.4. I am logging in through phone number, which works fine. However, when I try to retrieve the account or access token, I get an empty object in the first case and undefined.

edo1493 commented 7 years ago

@gaguirre I have also tried to call configure, before trying to get the account object, but it doesn't make any difference.

creativefull commented 7 years ago

hi @edo1493 u need to setting in developer.facebook.com to disable secret key. because if u use it maybe not working on android :)

creativefull commented 7 years ago

image

try make your setting on product account kit like this :)

azharkiz commented 6 years ago

i am using Facebook Account Kit for OTP verification in react native. everything is working is working but i can't find a way to get the mobile number which is verified.. please help me guys?

RNAccountKit.getCurrentAccount().then(account => {
  console.log(`Current account: ${account}`)
})
rassemdev commented 6 years ago

@azharkiz i'm also stuck here too :(. if you found any solution, notify me plz

amanix007 commented 6 years ago

errorapture Even my "Require App Secret" set to "No" and "Enable Client Access Token Flow" set to "Yes" Still Having same issue.

azharkiz commented 6 years ago

In my case i wrote Require App Secret" set to "yes" then i am changed it into "no" at that time i got the account details. In your case i suggestion you check your code.

On May 20, 2018 1:45 PM, "amanix007" notifications@github.com wrote:

[image: errorapture] https://user-images.githubusercontent.com/13711025/40276922-97f73e32-5c37-11e8-996a-b2affa4f5b31.PNG Even my "Require App Secret" set to "No" and "Enable Client Access Token Flow" set to "Yes" Still Having same issue.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/underscopeio/react-native-facebook-account-kit/issues/36#issuecomment-390465250, or mute the thread https://github.com/notifications/unsubscribe-auth/Ai3dmbKhyjxJcnTqwIEhD9oefl0HWUOMks5t0SYEgaJpZM4Ju3Uk .

amanix007 commented 6 years ago

hi @azharkiz Thanks for reply , if you have time kindly see this repository, i uploaded my project here. https://github.com/amanix007/demorepo Accountkit used file https://github.com/amanix007/demorepo/blob/master/src/components/signIn/index.js It will be really helpful for me, my job depends on it. :( Thanks in Advance.

rassemdev commented 6 years ago

@azharkiz can you share your code? i'm new in react-native

azharkiz commented 6 years ago

You refer the facebook account kit authentication react native youtube 1 hr video you can get the result..

On May 21, 2018 8:11 AM, "rassemdev" notifications@github.com wrote:

@azharkiz https://github.com/azharkiz can you share your code? i'm new in react-native

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/underscopeio/react-native-facebook-account-kit/issues/36#issuecomment-390538252, or mute the thread https://github.com/notifications/unsubscribe-auth/Ai3dmbkOwybEp8bG3WelRapzn9FVPdlTks5t0ildgaJpZM4Ju3Uk .

aderiushev commented 6 years ago

having the same issue, setting "Require App Secret" to "NO" didn't do the trick..

creativefull commented 6 years ago

anyone got a solution for this error ?

lilian131 commented 6 years ago

@creativefull hi I had the same problem with a cordova plugin in ionic for me it was because despite removing the token with a normal way when logout

localStorage.removeItem('token');

I had to use the method provided to destroy the token like

AccountKitPlugin.logout();

and it works!! Hope this will help other because this was something really frustrating as it made my server always crashed

sunnixx commented 5 years ago

Hi Any update on this ? I am trying to implement RNAK using example for RN057 but I am not able to get the account details after SMS

jpgarcia commented 5 years ago

Closing this due to inactivity