[英]Firebase React Native Expo login error with google
Error message: (0, _auth.signInWithRedirect) is not a function. (In '(0, _auth.signInWithRedirect)(_firebaseConfig.authentication, _firebaseConfig.provider)', '(0, _auth.signInWithRedirect)' is undefined)
错误消息: (0, _auth.signInWithRedirect) is not a function. (In '(0, _auth.signInWithRedirect)(_firebaseConfig.authentication, _firebaseConfig.provider)', '(0, _auth.signInWithRedirect)' is undefined)
Even though I did everything right, it gives this error.即使我做的一切都正确,它也会出现此错误。 It works on the web but I get this error on my android phone.它适用于 web,但我在 android 手机上遇到此错误。
My login function:我的登录 function:
const signInWithGoogle = async () => {
try {
const result = await signInWithRedirect(authentication, provider);
const user = result.user;
console.log(user)
}
catch (error) {
const errorMessage = error.message;
console.log(errorMessage)
};
}
signInWithRedirect
does not work in React Native. signInWithRedirect
在 React Native 中不起作用。 From Firebase blog -来自 Firebase博客——
Headful" auth methods such as signInWithPopup(), signInWithRedirect(), linkWithPopup(), and linkWithRedirect() do not work in React Native (or Cordova, for that matter). You can still sign in or link with a federated provider by using signInWithCredential() with an OAuth token from your provider of choice. Headful”身份验证方法,例如 signInWithPopup()、signInWithRedirect()、linkWithPopup() 和 linkWithRedirect() 在 React Native(或 Cordova,就此而言)中不起作用。您仍然可以通过使用signInWithCredential() 使用您选择的提供商提供的 OAuth 令牌。
You can use signInWithCredential
or use React Native Firebase您可以使用signInWithCredential
或使用React Native Firebase
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.