I am trying to implement Firebase Google Authentication in my react native application. but getting DEVELOPER_ERROR. error code 10.
It works once then when I try to run it again after a week I get the same error.
What I have tried so far. 1. checked Web Client ID its correct. 2. Debug Keystore is also correct checked it almost 20 times. 3. Deleted Firebase project and created a new one.
componentDidMount = async () => {
// Google Configure
await GoogleSignin.configure({
webClientId: 'xxxxxxxxxxxxxx.apps.googleusercontent.com',
offlineAccess: true
})
}
firebaseSignIn = async () => {
try {
const data = await GoogleSignin.signIn();
// create a new firebase credential with the token
const credential = firebase.auth.GoogleAuthProvider.credential(data.idToken, data.accessToken)
// login with credential
const currentUser = await firebase.auth().signInWithCredential(credential);
//Update Data in Firebase
this.props.updateAuth(this.state.first_install, this.state.first_open)
} catch (e) {
console.log(e.code)
}
}
Common pitfalls to get DEVELOPER ERROR:
What makes it more confusing is that most solution are for native use and not React Native, the difference is that RN libs usually involves using web APIs (they are more usable in JS).
You need to take client_id from client_type": 3 as web client id. type 3 indicate web client id.
{
"client_id": "892474276945-9lj7c1fjnp33r6e88toad2jfo0l3lmb4.apps.googleusercontent.com",
"client_type": 3
}
Also, you need to add two SHA-1 key. one is your using app's release Keystore and the second is from your play store console if your app is live
into firebase console
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With