atl*_*teh 18 facebook firebase react-native firebase-authentication
最近firebase团队发布了新版本的firebase 3.1,它与react-native兼容.我正试图在facebook上使用新的firebase api.
由于firebase不支持react-native中的弹出或重定向,我使用react-native-fbsdk来获取访问令牌,但是当我尝试使用auth.signInWithCredential时,登录失败
代码:"auth/app-not-authorized",
消息:"此应用由托管的域识别,无权使用提供的API密钥使用Firebase身份验证.请在Google API控制台中查看您的密钥配置."
这是我的代码.任何帮助将非常感谢.
import { LoginManager, AccessToken} from 'react-native-fbsdk';
import firebase from '../Services/firebase';
const auth = firebase.auth();
const provider = firebase.auth.FacebookAuthProvider;
LoginManager.logInWithReadPermissions(['public_profile'])
.then(loginResult => {
if (loginResult.isCancelled) {
console.log('user canceled');
return;
}
AccessToken.getCurrentAccessToken()
.then(accessTokenData => {
const credential = provider.credential(accessTokenData.accessToken);
return auth.signInWithCredential(credential);
})
.then(credData => {
console.log(credData);
})
.catch(err => {
console.log(err);
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5183 次 |
| 最近记录: |