Firebase Facebook认证:认证凭证格式错误或过期

时间:2019-08-09 09:21:08

标签: facebook firebase react-native firebase-authentication

我正在使用Facebook身份验证和Firebase开发React Native ios应用。 我创建了我的Facebook应用程序,将密钥复制到了我的Firebase Facebook身份验证模式,但是当我尝试使用Firebase使用Facebook凭据登录时,出现此错误:The supplied auth credential is malformed or has expired.

我看了一个问题:FB login - Firebase.Auth() Error: The supplied auth credential is malformed or has expired,它与我的非常相似,但是答案没有帮助我,因为我的Facebook应用程序配置中的密钥与我的Firebase Facebook身份验证模式中的密钥相同

这是当按下facebook auth按钮时我正在使用的代码:

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);
      },
    );
  };

我希望你们能帮助我,也许当我配置我的Facebook应用程序时我误认为了。

谢谢。

1 个答案:

答案 0 :(得分:0)

事实证明,firebase 不支持 Facebook Graph API,但请检查一下 the reason why Graph API is not supported

相关问题