通过这段代码。
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。
Possible Unhandled Promise Rejection (id: 0):
TypeError: this.addScope is not a function. (In
'this.addScope("profile")', 'this.addScope' is undefined)`
请问有什么问题