Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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)


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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading