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 7 years ago
  • Reactions: 84
  • Comments: 103

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

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!

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.

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

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 have the same error …

same here

. the same

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

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 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 {

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.

only this works for me, no firebase, only expo weird af

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


tricky steps for android

  1. generate new debug.keystore
sudo keytool -genkey -v -keystore my-upload-key.keystore \
  -storepass android -alias androiddebugkey -keypass android  \
  -keyalg RSA -keysize 2048 -validity 100000
  -dname "CN=serhii, OU=debug, O=private, L=home, ST=0, C=UA"
  1. place new debug.keystore instead the old ones in the ./android/app folder
  2. generate new sign in report cd android && ./gradlew signingReport
  3. paste sha1 keys into the firebase console android project settings input sha1 fingerprints
  4. download google-service.json
  5. copy the value of client_id with client_type: 3 to the webClientId property.
  6. build the android app Steps described helped me and I was able to sign in with google after many hours of struggling.

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

I’m using Firebase. The solution for me was to copy the google-services.json file also under the subfolders for different variants. So I have this file in app/google-services.json and additionally app/src/dev/google-services.json, app/src/test/google-services.json, app/src/production/google-services.json etc. At first I thought that it’s enough to have the file in the app folder like stated here but looks like this will not work by default.

Also, be sure which key is being used to sign your dev/test app and add your debug key SHA1 to the Firebase console. Use the signingReport task in Android Studio -> Gradle menu to double-check. Or unzip your .apk and check the cert fingerprint in the META-INF directory.

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!

keytool -list -v -keystore C:\Users\reidk\Documents\Git\Pr ojectR\android\app\debug.keystore -alias androiddebugkey -storepass android -keypass android

God bless you in 2025!!

if you no using firebase :

do this command : cd android && ./gradlew signingReport

copy SAH1 key and put in your id client Android in google cloud 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.

After running the command keytool -list -v -alias androiddebugkey -keystore android/app/debug.keystore -storepass android -keypass android from the project root, I obtained the SHA1 fingerprint. I then opened Firebase and navigated to the settings for the Android project. There, I added the SHA1 fingerprint as the certificate fingerprint, and it worked successfully.

wow. this error really needs to be less vague. I have the correct SHA1 from the keystore specified in my gradle script and the correct app ID. No dice. If this error actually described what the problem was in any way I could potentially fix it

Non-firebase users that let Google sign their app: Under the Google Cloud Console > APIs & Services > Credentials > Client ID for Android, set your SHA-1 to the App signing key certificate found in the Play Store Console > Setup > App signing.

You’ll know it works because Verify app ownership under the Client ID for Android page will say “Your app ownership has been verified”.

  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]

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.

Yeah, the same issue I had. i was checking the release build and it was working fine but after pushing it to play store it was not working. But it’s working now. Thanks

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.

I am getting this error in play store and not in debug mode. I have also copied SHA to firebase console 😦

@itzpradip try: 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 spend an week try solve this problem with my android app, thanks a lot! ❤️

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.