【问题标题】:Firebase Facebook authentication : Malformed or expired auth credentialFirebase Facebook 身份验证:格式错误或过期的身份验证凭据
【发布时间】:2019-12-17 00:23:45
【问题描述】:

我正在使用 facebook 身份验证和 firebase 开发一个 react native ios 应用程序。 我创建了我的 facebook 应用程序,将密钥复制到了我的 firebase facebook auth 模式,但是当我尝试使用 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 auth 模式中的密钥相同。

这是我在按下 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 应用程序时弄错了。

提前谢谢你。

【问题讨论】:

  • 嘿,保罗,你发现了吗?我使用facebook工具调试令牌,所有数据都是正确的(令牌没有过期)如果我多次登录,最终它可以工作
  • 嘿,我也有同样的问题。我在这里打开了一个问题link。 @mercilessmaverick 对我来说,当用户第一次登录时它永远不会发生,但如果用户已经注册,它会发生 10 次中的 9 次。我已检查我的 Facebook 应用 ID 和密码在 Firebase 上是否正确设置,我还尝试重置 Facebook 密码。

标签: facebook firebase react-native firebase-authentication


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-26
    • 2020-05-07
    • 2017-01-25
    • 2015-06-01
    • 2021-07-08
    • 1970-01-01
    • 1970-01-01
    • 2017-11-27
    相关资源
    最近更新 更多