Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DEVELOPER_ERROR error code 10 - Firebase google login in react native

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)
      }
    }
like image 402
Samir Shaikh Avatar asked Jun 07 '26 08:06

Samir Shaikh


2 Answers

Common pitfalls to get DEVELOPER ERROR:

  1. A lot of people miss this! But you should have both a web client and an Android/iOS client configured in OAuth (just fill what is necessary in the web client)
  2. Wrong SHA-1 configured in the Android client - you have totally different keys when debugging/dev, releasing a bundle/APK, and when you publish a bundle/APK with Play Store (there is an option there to let Google manage your publishing key, most people just go with it - this make your signature different, you can find it under "App integrity"/"App signing" in Play Console)
  3. Didn't set OAuth consent screen in Play Console
  4. Use your web client ID in your code (not the Android/iOS client)

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).

like image 51
eyalyoli Avatar answered Jun 09 '26 00:06

eyalyoli


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 enter image description here into firebase console

like image 37
Rajesh Nasit Avatar answered Jun 08 '26 22:06

Rajesh Nasit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!