Home > Mobile >  Firebase React Native Expo login error with google
Firebase React Native Expo login error with google

Time:05-07

Error message : (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.

My login 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)
    };
}

CodePudding user response:

signInWithRedirect does not work in React Native. From Firebase blog -

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.

You can use signInWithCredential or use React Native Firebase

  • Related