2

I'm working on a react native ios app using facebook authentication and firebase. I created my facebook app, copied the secret keys to my firebase facebook auth mode, but when i'm trying to sign in with facebook credential using firebase I'm getting this error : The supplied auth credential is malformed or has expired.

I had a look at this issue : FB login - Firebase.Auth() Error: The supplied auth credential is malformed or has expired which is the quite similar to mine, but the answer didn't help me because my keys are the same in my facebook app configuration than in my firebase facebook auth mode.

Here is the code i'm using when the facebook auth button is pressed :

facebookLogin = () => {

  LoginManager.logInWithPermissions(['public_profile', 'email'])
    .then(
      (result) => {
        if (result.isCancelled) {
          Alert.alert('Whoops!', 'You cancelled the sign in.');
        } else {
          AccessToken.getCurrentAccessToken()
            .then((data) => {
              const credential = firebase.auth.FacebookAuthProvider.credential(data.accessToken);
              console.log(credential);
              firebase.auth().signInWithCredential(credential)
            .then(() => this.props.navigation.replace('Home'))
            .catch((error) => {
              console.log(error.message);
              this.setState({ errorMessage: error.message })
            });
          });
        }
      },
      (error) => {
        Alert.alert('Sign in error', error);
      },
    );
  };

I hope you guys can help me, maybe I mistook when I configured my facebook app.

Thank you in advance.

  • 1
    Hey Paul, did you figure this out? I used the facebook tools to debug the tokens and all the data is correct ( the token is not expired ) If I sign in multiple times, eventually it works – MercilessMaverick Oct 14 '19 at 14:16
  • 1
    Hey, I also have the same problem. I opened an issue here [link](https://github.com/invertase/react-native-firebase/issues/2730). @mercilessmaverick for me it never happens when the user logs in for the first time, but it happens 9 out of 10 times if the user is already registered. I have checked that my Facebook App ID & secret are set up correctly on Firebase and I also tried reseting the Facebook secret. – e_pie Oct 15 '19 at 10:58

1 Answers1

0

turns out Facebook Graph API is not supported by firebase yet check this out the reason why Graph API is not supported