このコードでは、create-react-native-appとfirebase(exponentを使用)でgoogleでログインしてください
googleAuthenticate = (token) => {
const provider = firebase.auth.GoogleAuthProvider();
const credential = provider.credential(token)
return firebase.auth().signInWithCredential(credential) }
gglogin = async() => {
const LogInResult = await Google.logInAsync({
androidClientId: '<my-androidClientId>',
iosClientId: '<my-IOSClientId>',
scopes: ['profile', 'email']
});
if(LogInResult.type === 'success'){
Alert.alert(
'Logged in!',
`Hi ${user.name}!`,
);
this.googleAuthenticate(LogInResult.accessToken)
}
}
これは、ユーザ名の警告を得ることができますが、このエラーを取得することにより、firebaseにトークンを送信することはできませんです。 https://firebase.google.com/docs/reference/js/firebase.auth.GoogleAuthProvider
あなたはあなたを変更する必要があります。
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('email');
firebase.auth().signInWithRedirect(provider);
再びこの文書を確認してください:
Possible Unhandled Promise Rejection (id: 0):
TypeError: this.addScope is not a function. (In
'this.addScope("profile")', 'this.addScope' is undefined)`
は
あなたを共有することができますapp.jsonまたはgithub repoリンク? –
私は、エキスポのスタンドアロンAndroidアプリでGoogleログインに問題があり、ユーザー名やプロフィールを取得できません。私はあなたのapp.jsonファイルをチェックして、私が間違いを犯していないかどうかを確認したかったのです –