我已在Media上关注此帖子,尝试实施firebase身份验证:https://blog.invertase.io/getting-started-with-firebase-authentication-on-react-native-a1ed3d2d6d91
我首先使用Facebook实现了社交身份验证并且工作正常,但在此之后,当我成功完成Google身份验证部分时,Facebook部分被卡在了一行
return firebase.auth().signInWithCredential(credential);
因为它之后没有返回用户Promise所以Firebase onAuthStateChanged无法记录用户
处理facebook身份验证的功能:
onLoginOrRegisterFacebook = () => {
LoginManager.logInWithReadPermissions(["public_profile", "email"])
.then(result => {
if (result.isCancelled) {
return Promise.reject(new Error("The user cancelled the request"));
}
// Retrieve the access token
return AccessToken.getCurrentAccessToken();
})
.then(data => {
// Create a new Firebase credential with the token
const credential = firebase.auth.FacebookAuthProvider.credential(
data.accessToken
);
// Login with the credential
return firebase.auth().signInWithCredential(credential);
})
.then(user => {
})
.catch(error => {
const { code, message } = error;
});
};

Google Firebase身份验证控制台中的Facebook登录方法也启用了我的FB应用程序的足够信息,我还将OAuth重定向URI粘贴到我的Facebook应用程序配置中,Facebook Developer的仪表板也成功显示已安装的应用程序用户