google-signin: Android gives 'ERROR: DEVELOPER_ERROR' when signing in

When signing in using await GoogleSignin.signIn(); It opens the dialog, I sign in but gives the 'ERROR: DEVELOPER_ERROR'

Steps to Reproduce

  • Install react-native-google-signin and follow the setup guide for Android
  • Import react-native-google-signin and make a function that calls await GoogleSignin.signIn()
  • Sign in with your google account
  • When the dialog closes the error occurs

Expected Behavior

  • Opens dialog
  • Signs in
  • Returns userInfo, id and accesstoken

Actual Behavior

  • Throws an error saying 'ERROR: DEVELOPER_ERROR'

Environment

  • react-native: 0.60.4
  • react-native-google-signin: 2.0.0
  • play-services-auth: 15.0.1
  • SDK version: 25
  • Build gradle: 3.4.2
  • Tried two newest versions of android, Q & Pie

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 67
  • Comments: 84 (1 by maintainers)

Most upvoted comments

I fixed it by entering correct SHA-1 in firebase console. Problem was I was using following command for generating SHA-1 from my project directory

keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

Here path for the debug.keystore is in ~/.android folder which is different, my keystore was inside <project-dir>/android/app, So I followed this new path in command, which was in my project directory

keytool -exportcert -list -v -alias androiddebugkey -keystore ./android/app/debug.keystore

Then (1) copied the SHA-1, and (2) enter it in project of firebase console then (3) download the config file again and replace it in android/app folder then (4) remove the build and install again, it worked!


EDIT: For some reasons, on a few computer devices you also have to perform these steps. -> Close the terminal and uninstall the application from the mobile device. remove android/build folder and remove android/app/build folder. Now install again on your device.

If you get error like … Only one command is allowed: both -exportcert and -list were specified. Solution: remove -exportcert from command, thus command will be …keytool -list -v -alias androiddebugkey -keystore ./android/app/debug.keystore

for poor souls like me who used the android client id,

you have to add your web client id. not android client Id.

its quite obvious people might think they have to add the android client id since they are building it for android. but it is the web client id that you have to add.

I wanted to add my 2 cents. I thought I had everything setup correctly, then I realized I had a file called debug.keystore in my android/app folder.

I used the command keytool -list -v -keystore C:\Users\reidk\Documents\Git\Pr ojectR\android\app\debug.keystore -alias androiddebugkey -storepass android -keypass android to read the sha1 key from the react-native debug keystore. Then I added that to firebase, and now everything works great!

Same

UPDATE: I was able to get it working by adding the debug key to the Firebase project. Was able to retrieve the debug SH1 key via keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android

same here

I have the same error …

Google Sign In does not work

If you uploaded your app to Google Play you will need to add the SHA-1 key from GooglePlay to your firebase console too?

Go to your https://play.google.com/console/developers then select your app then go to Sign Certificate App. Copy the SHA1-key and paste into Firebase console of your project, download the google-service.json file and put it on android/app folder build your app and test again in production.

. the same

the same

For anyone banging their heads on this in the future. I had this issue in production after deploying my app to the Play Store. The problem happens because i’m using the managed app signing service so the Play Console actually manages the App Signing Keys and therefore your app would actually have a different signing key when deployed on the Play store…

To find that key you must go to the Play Developer Console under Setup > App Integrity > App Signing and find the SHA-1 certificate and enter that into your Firebase console.

I spent more time than I’d care to admit on this, so writing down what I found, in the hope that it’ll be helpful to someone.

  • I’m not using Firebase
  • I’m using Expo, and I’m using managed credentials
  • My GoogleSignin.configure call:
GoogleSignin.configure({
  webClientId: YOUR_WEB_CLIENT_ID,
  offlineAccess: true,
});

What I found:

  • google-services.json isn’t needed. Don’t include googleServicesFile in app.json/app.config.js.
  • In Google Cloud Console, create 3 OAuth 2.0 Client IDs:
  1. Application type=“Web application”. Pass this client ID to GoogleSignin.configure as webClientId.
  2. Application type=“Android”. Make sure Package name is correct. Get SHA-1 certificate fingerprint by running keytool -list -v -alias androiddebugkey -keystore android/app/debug.keystore -storepass android -keypass android from the project root.
  3. Application type=“Android”. Make sure Package name is correct. Get SHA-1 certificate fingerprint by running eas credentials from the project root. Select Android as the platform, then select your build profile.

I am not using Firebase and still facing DEVELOPER_ERROR.

I created both OauthCilent android and Web client 2 and giving Web client id here to signin

GoogleSignin.configure ({ webClientId: '.apps.googleusercontent.com’, }) also to create SHA-1 for android* used this command to C:\Users\satailor\Documents\ReactNative_workspace\App>keytool -list -v -alias androiddebugkey -keystore C:\Users\satailor\Documents\ReactNative_workspace\app\android\app\debug.keystore

and copied SHA-1 and added in google cloud console for same while creating android credentials and provided same package name.

Inside Android folder following changes are added: settings.gradle file include ':react-native-google-signin', ':app'

android/build.gradle file included following lines:

buildscript {
 ext {
     googlePlayServicesAuthVersion = "17.0.0"
}
dependencies { 
classpath 'com.google.gms:google-services:4.3.2'} 
Help me to resolve an issue. Let me know any other information required.

g9

Is there any solution for this ? thank you

@reidkersey thank you very much, I was trying keytool -exportcert -keystore ~/.android/debug.keystore -list -v which ofcourse was giving me a SHA1 key but it was not working , after your comment I also look closer into my project/android/app folder and found that there is a debug.keystore key too (whose default password is “android” , incase some need to know ) so I tried keytool -exportcert -keystore app/debug.keystore -list -v running the command under my android folder and the key I got ,worked really well. thank. you.

@SanjanaTailor did you find any solution?

I fixed it by making sure the sha1 key in my firebase android project is the correct one. I did that performing the following:

  • Inside of my project folder, I cd into android and run ./gradlew signingReport'
  • Copy the sha1 key under > Task :app:signingReport with the property and value **Config: debug**, and **Variant: debugUnitTest**
  • Paste it in your firebase android project by clicking on add finger print

Make sure you have copied the google-services.json file inside of your /android/app/ folder

I was also facing the same issue. My debug keystore’s SHA1 was not working. I solved it by adding following code in android/app/build.gradle

signingConfigs {

For me, it wasn’t working until I provided offlineAccess:true GoogleSignin.configure({ webClientId: "...", offlineAccess: true });

So, finally, I found a solution for this. My package. name in firebase and in the app were different, I had to delete and create again the app on Firebase, and now is working like a charm!

We are having issues with this still.

We are using the web client id, not the android client id.

In development Google Sign In works. In release, Google Sign In does not work. Is there anything else that it could be?

Edit: Both of our SHA-1 keys (from debug keystore and upload keystore) are in our firebase console.

I solved this problem following this steps https://stackoverflow.com/questions/47437678/why-do-i-get-com-google-android-gms-common-api-apiexception-10

Did you both add new credentials to API Console and add your key to your Firebase project? I’m getting “duplicate fingerprint” if I do both… If i skip adding cred to API console I’m getting error message: “Must specity an idToken och an accessToken”. I’m using GoogleSignIn.configure()

This is my code:

        await GoogleSignin.configure();

        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 firebaseUserCredential = await firebase.auth().signInWithCredential(credential);


  1. Remove the app from the google play store
  2. Generate an new APK to upload to google play
  3. Voila, you will have the new SHA-1 that is on your app in the google play store.

On Sat, 24 Dec 2022 at 15:50, Lê Vũ Huy @.***> wrote:

I have tried all above suggestion but nothing work at all 😦

— Reply to this email directly, view it on GitHub https://github.com/react-native-google-signin/google-signin/issues/706#issuecomment-1364540808, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGR3T3P3KST6SRLQXET7NDWO4ESFANCNFSM4IMFTPEA . You are receiving this because you commented.Message ID: @.*** com>

– With regards Cyrus_Zei [ Developer + Designer = Unicorn]

PRO TIP:

Even if you think you have the correct webClientId just copy it from firebase and paste it in. Spent way to much time on debugging this

@mitjnextt I resolved this issue, it was caused by wrong SHA. The reason was the confusion between firebase and google cloud project. They were 2 different projects in google cloud. I found out that firebase creates google cloud project by default.

@itzpradip try: keytool -list -v -alias androiddebugkey -keystore ./android/app/debug.keystore

I fixed it by entering correct SHA-1 in firebase console. Problem was I was using following command for generating SHA-1 from my project directory

keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

Here path for the debug.keystore is in ~/.android folder which is different, my keystore was inside /android/app, So I followed changed the path in command

keytool -exportcert -list -v -alias androiddebugkey -keystore ./android/app/debug.keystore

Then (1) copied the SHA-1, and (2) enter it in project of firebase console then (3) download the config file again and replace it in android/app folder then (4) remove the build and install again, it worked!

I followed @mitjnextt steps and mine is now working. The only thing that I didn’t do was to download the config file again, it still worked…not sure if that will bite me somewhere else but thanks a lot for the tip.

hello, please see this doc improvement, it should help. https://github.com/react-native-community/react-native-google-signin/pull/737/files

if this does not help, please provide careful repro steps. Thanks.

Is necessary to generate the Keystore file through command line, I had the same issue with a published app, I generated the Keystore with Android Studio, so I contacted with Google support and they help me and I generate new Keystore file with the following tutorial: https://facebook.github.io/react-native/docs/signed-apk-android, they update the keystore of my published app and after three days the DEVELOPER ERROR is gone.