FB登录-Firebase.Auth()错误:提供的身份验证凭证格式错误或已过期 [英] FB login - Firebase.Auth() Error: The supplied auth credential is malformed or has expired

查看:752
本文介绍了FB登录-Firebase.Auth()错误:提供的身份验证凭证格式错误或已过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用react-native-fbsdk: 0.8.0, react-native-firebase: ^5.2.2, react-native: ^0.57.4和Facebook测试用户帐户.

I'm using react-native-fbsdk: 0.8.0, react-native-firebase: ^5.2.2, react-native: ^0.57.4 and Facebook Test User account.

这突然发生了. 从Firebase注销后,尝试再次使用Facebook登录.

This happened so suddenly. Once I sign out from firebase and try to log in again with Facebook.

错误:提供的身份验证凭证格式错误或已过期. [来自facebook.com的USER_INFO的远程站点5XX].

Error: The supplied auth credential is malformed or has expired. [ Remote site 5XX from facebook.com for USER_INFO ].

我尝试了AccessToken.refreshCurrentAccessTokenAsync(). 但是给我错误:无法刷新访问令牌.

I had tried AccessToken.refreshCurrentAccessTokenAsync(). But give me Error: Failed to refresh access token.

Facebook令牌将在60天后过期.检查令牌的过期日期是2019年4月29日. 更改测试用户帐户密码,然后再次重新登录.

The Facebook token will expire in 60 days. Checked the token expired date is Apr 29, 2019. Change the test user account password and re-login again, still the same.

在Facebook或Firebase设置中我需要做些什么吗?

Is there anything I need to do in facebook or firebase setting?

const result = await LoginManager.logInWithReadPermissions(["public_profile","email"]);

if (result.isCancelled) {
  this.setState({isLoading : false});
  Alert.alert('Error','Login cancelled. Please try again');
} else {              
  try{
    await AccessToken.refreshCurrentAccessTokenAsync();
  }catch(err){
    this.setState({isLoading : false});
    console.log('ereee',err);
  }

  const data = await AccessToken.getCurrentAccessToken();        
  var credential = firebase.auth.FacebookAuthProvider.credential(data.accessToken);
  console.log(data.accessToken);
  //here I get expired date is 2019 April 29
  console.log(moment(data.expirationTime).toDate());

  firebase.auth().signInWithCredential(credential)
    .then((usercredential)=>{                  
      if (usercredential){       
      }else{
        this.setState({isLoading : false});
      }
    })
    .catch((error) => {  
      console.log(error);
    }      
}

推荐答案

如果Firebase中的应用机密不正确,则会发生此问题

If the app secret is wrong in firebase than this problem occurs

如果访问令牌输入错误,也会出现此问题

if the access token is entered wrong than also this problem occurs

这篇关于FB登录-Firebase.Auth()错误:提供的身份验证凭证格式错误或已过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆