2

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)
      }
    }
Vinit Poojary
  • 178
  • 1
  • 19
Samir Shaikh
  • 46
  • 1
  • 1
  • 7

7 Answers7

9

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

Rajesh N
  • 6,198
  • 2
  • 47
  • 58
8

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

eyalyoli
  • 1,677
  • 17
  • 16
4

Hope this helps someone.

As I experienced DEVELOPPER_ERROR code 10 can happen due to two reasons.if you have done the coding part correctly. Check for GoogleSignin.configure()

  1. Invalid SHA-1
  2. Invalid Web Client ID

Make sure your SHA-1 is correct. cd android gradlew signinReport this will output sign-in reports from every Keystore. if you are developing native android apps your Keystore is located at ~USER\.android\debug.keystore and your React Native Keystore is located at PROJECT_DIR\android\app\debug.keystore (make sure that you got right SHA-1)

Typically, you can get id for webClientId from google-service.json located at client>oauth_client>clientid. since google-service.json contains details for every app in your firebase project make sure you are getting correct client id for your current project.

If this client id didn't work for you. you need to get Web Client Id from GCP Console. if GCP console doesn't have any OAuth 2.0 Client IDs of type Web Application, simply add a web app in firebase console and it will create a Web Application type id for you or you can create one manually in GCP console

AUPMA
  • 194
  • 2
  • 6
1

Did you check following GH thread https://github.com/googlesamples/google-services/issues/360#issuecomment-381648685

this comment helps me

Hi all. Error code 10 is DEVELOPER_ERROR:
https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes.html#DEVELOPER_ERROR

This almost certainly means you have not properly registered your SHA1 and Package Name in the Google API console:
https://developers.google.com/identity/sign-in/android/start

If you are 100% sure that you have done this correctly, make sure that your GoogleSignInOptions are correct. In particular, make sure the web client ID (if you're using it) belongs to the same project where you registered your package name and SHA1.

I am going to close this issue since that's the best advice I can provide with the limited information above.
Dima Portenko
  • 3,443
  • 5
  • 35
  • 48
1

Go to https://play.google.com/apps/publish Click on your application name. Go to SetUp. Select App Integrity. Copy both SHA1 one by one from below: 1. App signing key certificate 2. Upload key certificate

Go to Firebase: Select your app. Go to Project settings. General - Select android app. Add the above SHA1 to the SHA1 certificate fingerprints list.

Amit Patel
  • 1,795
  • 16
  • 20
0

I was facing the same issue, but later i was able to resolve the problem by following the below link.

https://github.com/googlesamples/google-services/issues/360#issuecomment-520024791

The issue is with the SHA1 Key which i have copied from my terminal using gradle SigningReport command. As per the above link i have used Android Studio to get the SHA 1 Key, i was able to see a difference between both the keys. With the key from Android Studio, i was able to sign-in with Google-Sign in for React native.

0

If you follow all steps properly, once check your

"webClientId"

with google-services.json

"client_id"

also use own debug KEYSTORE file and SHA-1 key.

This is work for me.

ronak dholariya
  • 177
  • 1
  • 6