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

Created on 16 Aug 2019  路  50Comments  路  Source: react-native-google-signin/google-signin

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

Most helpful comment

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!

All 50 comments

I have the same error ...

. the same

the same

same here

anyone ? started happening to me

Hi! Is there any solution?

Same here too...

Same here... :(

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


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

Yeap, I added the debug key sha1 in my project, but the accessToken not return in the signIn method like the doc https://github.com/react-native-community/react-native-google-signin#3-userinfo, you need get the token with method getTokens https://github.com/react-native-community/react-native-google-signin#gettokens.

Sorry my bad english... :D

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!

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

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.

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.

@akashmohan got it.. just get the Web client (auto created by Google Service) ID from google console -> credentials

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

Hi there.
I have same issure.
Please help me.
componentDidMount() {
GoogleSignin.configure({
webClientId: "504314064456-ps5ib5d6b2f1ieqcnqplav327eea610s.apps.googleusercontent.com"
});
}
state = {}
signIn = async () => {
try {
await GoogleSignin.hasPlayServices();
const userInfo = await GoogleSignin.signIn();
this.setState({ userInfo });
} catch (error) {
console.log(error);
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
// user cancelled the login flow
} else if (error.code === statusCodes.IN_PROGRESS) {
// operation (f.e. sign in) is in progress already
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
// play services not available or outdated
} else {
// some other error happened
}
}
};
render() {
return (







style={{ width: 192, height: 48 }}
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Dark}
onPress={this.signIn}
// disabled={this.state.isSigninInProgress}
/>



);

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

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! <3

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.

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.

@julitroalves In my Google Play Console, Under Setup -> App Signing, I see 2 different key certificates.

1: App Signing Key Certificate
2: Upload Key Certificate

My Upload Key cert matches what I have in my Firebase console. Yet the App Signing Key Cert doesn't match anything I have in FB. Could this be a potential issue as to why Google Sign In isn't working in Production?

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!

When a I run this command keytool -exportcert -list -v -alias androiddebugkey -keystore ./android/app/debug.keystore it ask me a "password for the key storage area".

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!

After using keytool -exportcert -list -v -alias androiddebugkey -keystore ./android/app/debug.keystore my terminal showing me this error keytool error: java.lang.Exception: Only one command is allowed: both -exportcert and -list were specified.

My keystore is in android/app directory and I'm having a DEVEOPER_ERROR

@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 put web ID but still it doesn't work

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 tried this comannd did not work here is the outcome

D:\PROJECTS\react\openPesa\android\app>keytool -exportcert -list -v -alias androiddebugkey -keystore
keytool error: java.lang.Exception: Only one command is allowed: both -exportcert and -list were specified.

i have same problem.
it works for me with other project's credential. but not with my new credential.
what could it be from?

  1. If you see a DEVELOPER ERROR, then make sure you have used the correct web client ID. You can cross-check it in google developer console open your project and see the Web client in OAuth 2.0 Client IDs section, not the android client, add the credentials of it in the firebase and in your code while configuring Google SDK.

  2. If you want to see your SHA-1 hash code of previously created debug.keystore file then type this command below in the terminal of android/app/ directory.

keytool -keystore debug.keystore -list -v

or create new one by this command below

keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 10000

  1. Also, make sure you clean the gradle build after making any changes while debugging by this command below.

cd android ./gradlew clean

After it, you can run the app again in your android emulator to test it.

  1. If you see a DEVELOPER ERROR, then make sure you have used the correct web client ID. You can cross-check it in google developer console open your project and see the Web client in OAuth 2.0 Client IDs section, not the android client, add the credentials of it in the firebase and in your code while configuring Google SDK.
  2. If you want to see your SHA-1 hash code of previously created debug.keystore file then type this command below in the terminal of android/app/ directory.

keytool -keystore debug.keystore -list -v

  1. Also, make sure you clean the gradle build after making any changes while debugging by this command below.

cd android ./gradlew clean

After it, you can run the app again in your android emulator to test it.

is that required to using firebase? i didn't saw it on documentation.

Not needed I was using firebase for my project and that's what I have done to fix the issue.

The main thing to notice is to use the web client id.

i was getting the [Error: DEVELOPER_ERROR] and after a day some other errors that i don't remember :)
i just added Firebase to project (and config) using rnfirebase and it get fixed magically.
i don't know how but it worked for me.

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 S
HA-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

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

Have you find a solution?

Ensure that the SHA1 key is added to your project and the entry is there in the google-services,json file.
Change the GoogleSignIn.configure() method parameter as empty

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

When you say config file do you mean google-services.json file please?

@SanjanaTailor did you find any solution?

@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

@victorbruce
Thank you but I am not using firebase so rather confused!!
Even tried expo google sign in..turns out it's also focused on firebase

@victorbruce
Thank you but I am not using firebase so rather confused!!
Even tried expo google sign in..turns out it's also focused on firebase

So sorry about that. I thought you were using firebase authentication. I had similar issues using expo for Oauth(especially with firebase) so I had to use react-native CLI instead. In the end, bare react-native is not as scary as I thought it will be.

Already, I was spending days solving errors upon errors in expo.

Hi,
I am facing a rather weird problem, I'm using GOOGLE SIGN WITHOUT FIREBASE.

I've done everything @victorbruce said and alot of other comments.
So, for me its working sometimes and not working other times.

Any workaround?

Hi,
I am facing a rather weird problem, I'm using GOOGLE SIGN WITHOUT FIREBASE.

I've done everything @victorbruce said and alot of other comments.
So, for me its working sometimes and not working other times.

Any workaround?

@callmemonky have you tried adding a reversed client id to your URL scheme inside Xcode? (Since you're not using firebase, I don't know if you have access to a client id for Google Sign?)

@victorbruce it's working fine in iOS, giving problem in Android only.

Also now, it's giving me some other error "A non-recoverable sign-in failure occured"

Any idea about this?

@victorbruce it's working fine in iOS, giving problem in Android only.

Also now, it's giving me some other error "A non-recoverable sign-in failure occured"

Any idea about it

This error is new to me. But have you generated a SHA1 key already? Does the platform you're using requires that you generate a SHA1 key?

I am not sure why, or how, but I am using react-native-dotenv to house my environment variables.

When using env.GOOGLE_WEB_CLIENT_ID I get DEVELOPER_ERROR - but if I just use the key directly it works.

Try logging the value in your console, the value you are setting in .env

I faced the same issue while working in different branches, so when I switched to different branch, it wasn't picking up the value for that environment.

So I just used react-native start --reset-cache

Was this page helpful?
0 / 5 - 0 ratings