Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29459

How to solve error facebook login in react native (android)?

$
0
0

I get a problem to login with facebook in react native (Android), I use this package https://github.com/facebook/react-native-fbsdk, in a mobile development is success, but in another mobile fail all.

This is my script:

async loginFacebook() {
    try {
      LoginManager.setLoginBehavior('WEB_ONLY');
      const result = await LoginManager.logInWithPermissions([
        "public_profile",
        "email",
      ]);

      if (result.isCancelled) {
        console.log('Login cancelled');
      }else{
        console.log(
          `Login success with permissions: ${result.grantedPermissions.toString()}`
        );

        const data = await AccessToken.getCurrentAccessToken();

        if (!data) {
          console.log('Something went wrong obtaining the users access token');
        }

        const credential = firebase.auth.FacebookAuthProvider.credential(
          data.accessToken
        );

        const firebaseUserCredential = await firebase
          .auth()
          .signInWithCredential(credential);

        alert(JSON.stringify(firebaseUserCredential.user.toJSON().email));

        console.log(firebaseUserCredential.user.toJSON().email);
      }
    } catch (e) {
      console.log(e);
    }
  }

The fail message in the app like this :

login failed: you can't use facebook to log into this app or website because there's an issue with implementation of facebook login

The message in the Inbox of Developer Facebook like this :

enter image description here

enter image description here

I tried to look for many examples, but fail all, they said that I must change the valid hash key and I done it (add valid hash key, release hash key and debug hash key). I don't know again how to solve this problem.

Please anyone help me to solve this problem.

Thanks.


Viewing all articles
Browse latest Browse all 29459

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>