'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 :
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 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aseem Gautam |
