react-native-google-signin / google-signin

Google Sign-in for your React Native applications
https://react-native-google-signin.github.io/
MIT License
3.23k stars 881 forks source link

Android gives 'ERROR: DEVELOPER_ERROR' when signing in #706

Closed jimmirbn closed 5 years ago

jimmirbn commented 5 years ago

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

Steps to Reproduce

Expected Behavior

Actual Behavior

Environment

Uemerson commented 5 years ago

I have the same error ...

longnk-1447 commented 5 years ago

. the same

jaaphou commented 5 years ago

the same

shekharskamble commented 5 years ago

same here

atrimn commented 5 years ago

anyone ? started happening to me

shyamalVixplor commented 5 years ago

Hi! Is there any solution?

AdeilsonSuperlogica commented 5 years ago

Same here too...

mauricioalexandres commented 5 years ago

Same here... :(

ccorneliusHsv commented 5 years ago

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

AdeilsonSuperlogica commented 5 years ago

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

Chbe commented 5 years ago

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);
AdeilsonSuperlogica commented 5 years ago

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

reidkersey commented 5 years ago

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!

brayanL commented 5 years ago

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.

aashishgaikwad commented 5 years ago

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 {

vonovak commented 5 years ago

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.

akashmohan commented 5 years ago

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.

sugaith commented 5 years ago

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

amitbravo commented 4 years ago

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

sanjanadhikaridev commented 4 years ago

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 (

Highlight high-light /ˈhaɪlaɪt/ noun 1. A mobile communciations assistant that reduces popup notifications to help you focus. 2. Your new best friend
        </View>
    );
mitesh-db commented 4 years ago

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

gbmahili commented 4 years ago

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.

julitroalves commented 4 years ago

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

QuintonC commented 4 years ago

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.

julitroalves commented 4 years ago

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.

AndresTIY commented 4 years ago

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

MatheusPires99 commented 4 years ago

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

itzpradip commented 4 years ago

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

kerron commented 4 years ago

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

lylest commented 4 years ago

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

lylest commented 4 years ago

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.

ph98 commented 4 years ago

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

itzpradip commented 4 years ago
  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.

ph98 commented 4 years ago
  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.

itzpradip commented 4 years ago

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.

ph98 commented 4 years ago

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.

SanjanaTailor commented 4 years ago

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

jorgeluis91x commented 3 years ago

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?

codemaker2015 commented 3 years ago

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

victorbruce commented 3 years ago

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

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

keshav263 commented 3 years ago

@SanjanaTailor did you find any solution?

victorbruce commented 3 years ago

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

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

keshav263 commented 3 years ago

@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 commented 3 years ago

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

prayaslashkari commented 3 years ago

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?

victorbruce commented 3 years ago

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

prayaslashkari commented 3 years ago

@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 commented 3 years ago

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

dale-french commented 3 years ago

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.

prayaslashkari commented 3 years ago

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