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)
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.keystoreHere 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.keystoreThen (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 androidsame here
I have the same error …
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 Signingand 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.
GoogleSignin.configurecall:What I found:
google-services.jsonisn’t needed. Don’t includegoogleServicesFileinapp.json/app.config.js.OAuth 2.0 Client IDs:GoogleSignin.configureaswebClientId.Package nameis correct. GetSHA-1 certificate fingerprintby runningkeytool -list -v -alias androiddebugkey -keystore android/app/debug.keystore -storepass android -keypass androidfrom the project root.Package nameis correct. GetSHA-1 certificate fingerprintby runningeas credentialsfrom the project root. SelectAndroidas 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.keystoreand 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:
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.
I fixed it by making sure the sha1 key in my firebase android project is the correct one. I did that performing the following:
./gradlew signingReport'**Config: debug**, and**Variant: debugUnitTest**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.
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:
On Sat, 24 Dec 2022 at 15:50, Lê Vũ Huy @.***> wrote:
– With regards Cyrus_Zei [ Developer + Designer = Unicorn]
PRO TIP:
Even if you think you have the correct
webClientIdjust 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.keystoreI 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.
I solved this problem following this steps https://stackoverflow.com/questions/47437678/why-do-i-get-com-google-android-gms-common-api-apiexception-10