简体   繁体   English

Firebase React Native Expo 谷歌登录错误

[英]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.

相关问题 将 firebase 导入 React Native 时出错 Expo - Error importing firebase to React Native Expo 如何在 React Native EXPO 中使用 FireBase 正确保留登录 state? - How to properly persist login state using FireBase in React Native EXPO? (错误:内部)使用 React Native Expo 测试 Firebase 函数 - (ERROR: internal) Testing Firebase functions using React Native Expo React Native - Expo 错误 - “在‘firebase’中找不到导出‘auth’: - React Native - Expo Error - "export 'auth' was not found in 'firebase' : 在我的 React Native expo 项目中使用 firebase 时出错 - Error in usage of firebase in my react native expo project 使用 Firebase 在 React Native Expo 应用程序中验证登录页面,但必须单击按钮两次才能执行完整的 function - Using Firebase to Authenticate login page in a React Native Expo App but have to click the button twice for the full function to execute 可能未处理的 Promise 拒绝 (id:0) | 反应原生 firebase 谷歌登录 - Possible Unhandled Promise Rejection (id:0) | React native firebase google login 混淆将 react-native-firebase 与 Expo 集成 - Confusion integrating react-native-firebase with Expo firebase react native expo:这些文件都不存在 - firebase react native expo : none of these files exist 在 firebase 上传图片 expo react native - Upload image in firebase expo react native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM