Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android - Updated to RN 61 now getting DEVELOPER ERROR #823

Closed
allthetime opened this issue Feb 26, 2020 · 57 comments
Closed

Android - Updated to RN 61 now getting DEVELOPER ERROR #823

allthetime opened this issue Feb 26, 2020 · 57 comments

Comments

@allthetime
Copy link

Hi, I updated my RN and now google sign-in is not working and returning the delightfully opaque DEVELOPER ERROR.

It works fine on iOS and nothing has changed in my code or setup.

This is my login code:

    async function googleLogin({ cancel, success }) {
        try {
            GoogleSignin.configure({
                webClientId: MY_WEB_CLIENT_ID,
            });
            const data = await GoogleSignin.signIn();
            const credential = firebase.auth.GoogleAuthProvider.credential(data.idToken, data.accessToken);
            const firebaseUserCredential = await auth().signInWithCredential(credential);
            if (firebaseUserCredential) setLoggedInGoogle(true);
            if (typeof success === 'function') success();
        } catch (e) {
            console.warn('GOOGLE ERROR', e);
            if (typeof cancel == 'function') cancel();
        }
    }

the full returned error:

YellowBox.js:71 GOOGLE ERROR Error: DEVELOPER_ERROR
    at Object.fn [as signIn] (NativeModules.js:99)
    at GoogleSignin.signIn$ (GoogleSignin.js:20)
    at tryCatch (runtime.js:45)
    at Generator.invoke [as _invoke] (runtime.js:271)
    at Generator.prototype.<computed> [as next] (runtime.js:97)
    at tryCatch (runtime.js:45)
    at invoke (runtime.js:135)
    at runtime.js:145
    at tryCallOne (core.js:37)
    at core.js:123
@klaaz0r
Copy link

klaaz0r commented Mar 2, 2020

I am having the exact same issue, doesn't work on device or emulator. Working great on iOS!

@vonovak
Copy link
Member

vonovak commented Mar 2, 2020

hello, there was a new keystore file added, see https://react-native-community.github.io/upgrade-helper/?from=0.60.6&to=0.61.5

maybe that is the cause. If this does not help, please add a runnable repro, otherwise this is not actionable. Thanks!

@klaaz0r
Copy link

klaaz0r commented Mar 3, 2020

@vonovak Maybe you can clarify this a little because the docs + issues I read seem to contradict sometimes.

So I am not using firebase so I use credentials directly. From what I can read in the docs:

  • Use the webClientId not the androidId, so I don't need to use my SHA1? it's not needed for setting up OAuth credentials.
  • Setup everything correctly and point to the right keystore (release and debug!). For release the play store generates signing keys, I need that SHA1? But I don't need the SHA1 at all since I am using OAuth credentials right?
  • Do I need to set the webClientId in the config? or should I skip it because I am using the keystore file?

I am pretty sure I get this error because something is wrong in the setup, but I tried everything from the docs.

@vonovak
Copy link
Member

vonovak commented Mar 3, 2020

Maybe you can clarify this a little because the docs + issues I read seem to contradict sometimes.
So I am not using firebase so I use credentials directly.

hello and thanks for the comment; I personally use firebase and so I don't have hands-on experience with other ways of consuming the library. Please, if you see there is any kind of problem with the docs, be so kind and contribute a PR, it'll be greatly appreciated, thank you!

@pasha-it
Copy link

pasha-it commented Mar 4, 2020

@klaaz0r did you find out the issue ? what's problem for setup ? I am getting the same errors.

@krewllobster
Copy link

I just inherited a code base built with react-native 0.61.4 and clean installed @react-native-community/google-signin today. I too am receiving a wonderfully opaque "DEVELOPER_ERROR" and I have followed the steps in the FAQ to make sure that I have the appropriate SHA-1 fingerprint in my firebase project settings. I am configuring google-signin with the webClientId found in the firebase console under Google authentication.

@pasha-it
Copy link

pasha-it commented Mar 5, 2020

@krewllobster awesome, attach fingerprint to firebase console, replace new google service json file and
await GoogleSignin.configure({ webClientId:"xxxxxxxx", offlineAccess: true });
then it works.

@klaaz0r
Copy link

klaaz0r commented Mar 5, 2020

@pasha-it I switched to firebase because I was using push notifications anyway. All you need todo is add all the finger prints (including debug, if you use that) and I should work. Is offlineAccess: true required?

@pasha-it
Copy link

pasha-it commented Mar 5, 2020

@klaaz0r I am not sure.

@brkrtp
Copy link

brkrtp commented Mar 5, 2020

I changed webClientId found in the firebase console under Google authentication, and add offlineAccess: true now its works!

@krewllobster
Copy link

I have tried all of the above and am still pulling the DEVELOPER_ERROR. Is there a description anywhere of what this actually means?

@allthetime
Copy link
Author

@krewllobster not in any detailed satisfying way; but in general it means that you aren't authenticating with the service properly; which can be a variety of things:

  1. using the proper webClientId in your javascript code which is supplied with your api credentials
  2. making sure your api credentials included in your native code are up to date (google-services.json or whatever)
  3. making sure you have the correct debug&release key finger prints included in the firebase or google services console.

Any of these things not being correct can lead to "DEVELOPER ERROR"

In my case, I needed to download and include an updated version of my google-services.json AFTER adding the new debug key finger print to the firebase console.

@krewllobster
Copy link

krewllobster commented Mar 9, 2020

@allthetime thanks for responding! Is it possible for an old fingerprint (from a different dev in a former time) could be conflicting? I think there are three SHA-1 fingerprints in the firebase console. I added 2, one is my debug SHA-1 (found via instructions in Android walkthrough) and the other is my release key. I know it works with my release key (finally!) but it still seems to not work in debug. Should I delete the old SHA-1 and re-download google-services.json?

Edit: Turns out that I had not explored the signing report quite enough and there was one more SHA-1 hash being used in debug mode that hadn't been added to the firebase project settings. If you're reading this thread because you're having this issue, double check to see if you are using any custom keys. It turns out that my app was using a custom debug key that was different to the default android debug key as it was stored in the android folder of the project. In the signing report I needed to go all the way back up to the top to see the debug mode SHA-1 hash for the actual app intent, and that's when I realized that there was an extra SHA-1. I am not an android dev, so I had never used the signing report before! Thanks for the input in this thread everyone.

@allthetime
Copy link
Author

@krewllobster finger prints don't conflict, but they will pollute your credentials making it a little more confusing to figure things like this out! I had the same thing going on with stale fingerprints being represented in my google-services.json.

@matheusbaumgart
Copy link

I'm also having this issue and it used to work before. I've tried creating a new Android app on the same Firebase project, triple checked every SHA-1 key, new debug keystore and new release keystore - Still no luck and getting the annoying DEVELOPER ERROR.

@stevenyap
Copy link

I have been trying to debug this for many hours and finally I resolve it by this:
#794 (comment)

I don't know why the webClientId from firebase does not work but from the Google Console API works. Perhaps someone can shed some light and also update it in the README?

@adnanirfan
Copy link

If you have key store file at this location {your_project_root}/android/app/debug.keystore, then use this file for making SHA1 hash for your project. Not the one you have at ~/.android/debug.keystore.
Ref: 794 Comment From monkibraum

@dgana
Copy link

dgana commented Mar 15, 2020

I got it to work you just have to add the webClientId from firebase

import {GoogleSignin} from '@react-native-community/google-signin';

await GoogleSignin.configure({
    webClientId: WEB_CLIENT_ID
 });

@stevenyap
Copy link

Looking through the issues and comments again, I think that the issue with webClientId is that if you are using react-native-firebase, then you need to get the webClientId from firebase.

But if you are not using that, you should get the webClientId from Google API console as per #794 (comment)

I am not using react-native-firebase so the webClientId as per the README does not work for me. My webClientId from Google API works.

@webdevfarhan
Copy link

In my case, I used second method to generate configuration file, it was generated as credentials.json so i renamed it to google-services.json. then i copied the debug.keystore file from C:\Users\username\.android\debug.keystore and replaced with RNProject/android/app/debug.keystore. This solved the developer error for me.

@choudharyjji
Copy link

Same DEVELOPER ERROR..

@Ahmed-ab96
Copy link

I have the same issue, while Generating the release APK.

@catmans1
Copy link

catmans1 commented Mar 27, 2020

My solution separate iOS and android platform.

      if (Platform.OS === 'android') {
        await GoogleSignin.configure({
          forceCodeForRefreshToken: true,
        })
      } else {
        await GoogleSignin.configure({
          webClientId: GOOGLE_CLIENT_ID,
          forceCodeForRefreshToken: true,
          iosClientId: GOOGLE_CLIENT_ID
        })
      }

@robbycp
Copy link

robbycp commented Mar 30, 2020

First, you have to be aware that in this issue, we're talking about error when updating RN to 0.61 (or using RN 0.61 or above perhaps). As @vonovak mentioned, there was a new debug.keystore https://react-native-community.github.io/upgrade-helper/?from=0.60.6&to=0.61.5.

In my case, previously I used RN v0.59.10 with react-native-google-signin v2.0.0. I generated keystore using this reference
https://stackoverflow.com/questions/15727912/sha-1-fingerprint-of-keystore-certificate
which used ~/.android/debug.keystore as the debug.keystore path.
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

Now I use RN 0.61.5 with react-native-community/google-signin v4.0.0. I solved it with new fingerprint, using new debug.keystore in android/app/debug.keystore, register the SHA to firebase console, download new google-services.json and replace old one.
keytool -list -v -keystore ./android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android

Also I didn't change any configuration and use webClientId from console.cloud => apis => credentials.
GoogleSignin.configure({ webClientId: GOOGLE_WEB_CLIENT_ID, })

@NicholasBertazzonAga
Copy link

Be sure to check in the Firebase Console, under "Authentication" -> "Sign-in methods" that Google is enabled, I found it disabled, I didn't even know that there was that option

@staufman
Copy link

If anyone is still having issues, I was able to find another source of trouble in this whole process. First, here was our setup:

Everything worked swimmingly with debug builds (we generated SHA1 hashes of our local dev keystore) and everything worked great with release APKs that we were installing directly to device (we generated a SHA1 hash of our production key to get this to work). However, when generating an AAB and uploading to the Beta channel and trying this version, we would get the nefarious DEVELOPER_ERROR.

The fix? I went into the PlayStore console and found a tab named "App Signing" under "Release management" There, I found yet another SHA1 which I then put into our Google Console account. After that, everything worked.

My theory? The PlayStore must be doing something when it creates a thinned app (not sure what it's called in Android land) that requires it to sign with some new certificates, behind the scenes. This SHA1 in the PlayStore console must correspond to these keys and was likely the missing piece.

@stevenyap
Copy link

@staufman This is because you are using .aab to publish your Android app in which the Play store will re-sign your app when pushed to production/testing track. Hence, you are required to use the App Signing SHA1 fingerprint which is the cert of Play store.

Please note that internal testing uses another set of signing by Play store and as such, you need to upload that SHA1 fingerprint as well if you are using the internal testing track of Play store.

Refer to https://github.com/react-native-community/google-signin/blob/master/docs/android-guide.md#faq--troubleshooting for more explanation.

@Akshayagt20
Copy link

Akshayagt20 commented Apr 4, 2020

resolved by:-
1. used SHA-1 created from android studio Gradle sign-in report from folder android/app
(Scroll to top up to find this )
2.Added this SHA-1 to fingerprint firebase console
3.Used web client id from firebase > authentication > sign in method > google> web sdk configuration > web client id.
(you can get also from google developer console. Take web client id auto created by Google service under OAuth 2.0 client ids )

react-native : 0.61.5
react-native-google-signin: 2.1.1

Thanks to all those who have commented for this issue.
Happy Coding
ps: ignore the grammar.

@tamangsuresh
Copy link

I have use google console webClientId, delete project from firebase and re-config it 4 times, check auth/google signin enable, but still getting
Screen Shot 2020-04-05 at 3 07 33 PM

@tamangsuresh
Copy link

I have both debug and release keystore but using debug keystore only. I fix this bug by including both sha-1 of debug and release in firebase console.

@ritesh-malav
Copy link

ritesh-malav commented May 19, 2020

If anyone is still having issues, I was able to find another source of trouble in this whole process. First, here was our setup:

Everything worked swimmingly with debug builds (we generated SHA1 hashes of our local dev keystore) and everything worked great with release APKs that we were installing directly to device (we generated a SHA1 hash of our production key to get this to work). However, when generating an AAB and uploading to the Beta channel and trying this version, we would get the nefarious DEVELOPER_ERROR.

The fix? I went into the PlayStore console and found a tab named "App Signing" under "Release management" There, I found yet another SHA1 which I then put into our Google Console account. After that, everything worked.

My theory? The PlayStore must be doing something when it creates a thinned app (not sure what it's called in Android land) that requires it to sign with some new certificates, behind the scenes. This SHA1 in the PlayStore console must correspond to these keys and was likely the missing piece.

@staufman You saved me lot of trouble.
I am able to update the SHA1 key provided by the google signin key. Any idea how can I get hash for facebook login as well ?

@FabricioGanzert
Copy link

FabricioGanzert commented May 19, 2020

Interesting, I'll definitelly take a loot into it when uploading my next app. Thank you , sir.

@davepaiva
Copy link

Surprisingly the SHA-1 from Android Studio was the issue. However when I got the SHA-1 from android/app/debug.keystore INSTEAD of android/debug.keystore it worked.
In project root directory use: keytool -keystore ./android/app/debug.keystore -list -v and press ENTER when asked for password

@fikrikarim
Copy link

fikrikarim commented Jun 19, 2020

I spent 3 hours reading each comment and following the advices but I still got DEVELOPER ERROR.

Then I realized my application package name was different than the package name in the Firebase app.

In my application the package name was:

com.myapp

In my firebase the package name was:

com.mycompany.myapp

So I followed this tutorial to change my app name. Then I searched the whole project for com.myapp to make sure everything was changed. Now it works 🎉

@irosadie
Copy link

I have both debug and release keystore but using debug keystore only. I fix this bug by including both sha-1 of debug and release in firebase console.

thank for this one, i have solved this issu by following your 💯

@rnnyrk
Copy link

rnnyrk commented Sep 3, 2020

Can't seem to solve this issue. I have two custom keystores setup.
What I did:

  1. Exported the SHA-1 with keytool -exportcert -alias KEYSTORE_ALIAS -keystore KEYSTORE_PATH and inserted this to my dev and prod app in Firebase
  2. Also on https://console.developers.google.com/ I have two OAuth 2.0-client-ID's with the correct package names and SHA-1 fingerprints
  3. Copied the webClientId from Firebase Console > Authentication > GoogleSignIn and added it before the signin with Google.Configure
  4. My Android build buildTypes are as following:
    buildTypes {
        debug {
            debuggable true
            productFlavors.dev.signingConfig signingConfigs.dev
            productFlavors.prod.signingConfig signingConfigs.prod
        }
        release {
            debuggable false
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            proguardFiles fileTree(dir: "${project.rootDir}/proguard_libs", include: ["*.pro"]).asList().toArray()
            productFlavors.dev.signingConfig signingConfigs.dev
            productFlavors.prod.signingConfig signingConfigs.prod
        }
    }
  1. Downloaded my latest google-services.json
  2. Ran ./gradlew clean and adb uninstall com.packagename
  3. npm run android

Still the same DEVELOPER_ERROR.
I'm really out of options.. Anyone suggestions?

@kushavi2509
Copy link

No matters weather you are using a firebase or NOT you have to have both the configurations (Android as well as Web client )
Screenshot 2020-09-09 at 5 35 45 PM

//DeveloperError or any login error
https://developers.google.com/identity/sign-in/android/start-integrating#next_steps

Click on Configure a prioject
Select the project.
Fille the required fields.
Voylla, you are good to go.

@pankajchaturvedi2244
Copy link

I was facing the same issue since last three days and getting the error of the DEVELOPER_ERROR.
Today I made some changes in my client auth0 project and it got working.
Some steps I used.

Regenerated new project and Auth0 Client on the console for android
Found my sha1 right from jdk/bin (as of above answers) and paste it to the android required SHA1 Field.
Replaced WebClientId to ClientId in my Google Configure function.
disabled offline access(to prevent NETWORK_ERROR).
now its working fine.

@SanjanaTailor
Copy link

Hello, Have you used with firebase or without firebase ?
I am using it without firebase google signin and trying it for android platform
GoogleSignin.configure ({
webClientId: '*****.apps.googleusercontent.com',
})

here ClientId is not supported.

I was facing the same issue since last three days and getting the error of the DEVELOPER_ERROR.
Today I made some changes in my client auth0 project and it got working.
Some steps I used.

Regenerated new project and Auth0 Client on the console for android
Found my sha1 right from jdk/bin (as of above answers) and paste it to the android required SHA1 Field.
Replaced WebClientId to ClientId in my Google Configure function.
disabled offline access(to prevent NETWORK_ERROR).
now its working fine.

@Rubiojen
Copy link

Rubiojen commented Nov 5, 2020

had the same issue. It is solved after I noticed that I put the wrong client_id to webClientId.
It should be the one with client_type": 3 in google-services.json not the first one.

@meetjpatel
Copy link

meetjpatel commented Dec 1, 2020

For someone facing similar issue, one of the reasons is not having appropriate SHA1 key configured in firebase. At least that's what happened in my case.
To fix this, on project's android root, I hit the command ./gradlew signingReport , which provided all the keystores details. What you are look for in the response is SHA1 keys for debug & release config(only android/app level stores, not library level stores. you'll find them in first couple of records in response). Grab those SHA1 keys, put them in Firebase's android app setting, download & place the updated google-services.json file at android->app.

@rnnyrk
Copy link

rnnyrk commented Dec 1, 2020

I think the latest comment of @meetjpatel is the only correct answer. Only way I found the correct SHA hashes. Although I want to add that while the app was live the Google Play Store console supplied different SHA hashes, which can be found under Configuration > App Signing on https://play.google.com/console

@amaljosea
Copy link

This worked for me

#706 (comment)

@shivanshrajpoot
Copy link

shivanshrajpoot commented Dec 17, 2020

Hi, I updated my RN and now google sign-in is not working and returning the delightfully opaque DEVELOPER ERROR.

It works fine on iOS and nothing has changed in my code or setup.

This is my login code:

    async function googleLogin({ cancel, success }) {
        try {
            GoogleSignin.configure({
                webClientId: MY_WEB_CLIENT_ID,
            });
            const data = await GoogleSignin.signIn();
            const credential = firebase.auth.GoogleAuthProvider.credential(data.idToken, data.accessToken);
            const firebaseUserCredential = await auth().signInWithCredential(credential);
            if (firebaseUserCredential) setLoggedInGoogle(true);
            if (typeof success === 'function') success();
        } catch (e) {
            console.warn('GOOGLE ERROR', e);
            if (typeof cancel == 'function') cancel();
        }
    }

the full returned error:

YellowBox.js:71 GOOGLE ERROR Error: DEVELOPER_ERROR
    at Object.fn [as signIn] (NativeModules.js:99)
    at GoogleSignin.signIn$ (GoogleSignin.js:20)
    at tryCatch (runtime.js:45)
    at Generator.invoke [as _invoke] (runtime.js:271)
    at Generator.prototype.<computed> [as next] (runtime.js:97)
    at tryCatch (runtime.js:45)
    at invoke (runtime.js:135)
    at runtime.js:145
    at tryCallOne (core.js:37)
    at core.js:123

Please do not call the configure function with any param as google-services.json includes all the required information(It's included as soon as you create a web client id in cloud console) hence calling it again with the webClientId is creating a configuration conflict hence getting DEVELOPER_ERROR.
Just use:
GoogleSignIn.configure()
It's not documented but it should be, on both https://rnfirebase.io/ and https://www.npmjs.com/package/@react-native-community/google-signin

@codemaker2015
Copy link

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

@ScottKaye
Copy link

ScottKaye commented Jan 18, 2021

For anybody like me attempting to NOT use firebase, this is how I got it working.

Create TWO OAuth tokens in Google Cloud Console. One web application key, and an Android key. Use the debug.keystore file in android/app/debug.keystore: keytool -keystore android/app/debug.keystore -list -v for your SHA1 value in the Android key. The package name is in android/app/build.gradle android.defaultConfig.applicationId.

The simple existence of this Android key, even though you are not using the actual client ID at all, means it will work. In configure(), use the web application client ID.

@hotaryuzaki
Copy link

here is my workaround for using Google API (no firebase)
we need both key Oauth2, web type for webClientID and android type to registering SHA-1 in google.
the detail here: #932

@neil-okikiolu
Copy link

For anybody like me attempting to NOT use firebase, this is how I got it working.

Create TWO OAuth tokens in Google Cloud Console. One web application key, and an Android key. Use the debug.keystore file in android/app/debug.keystore: keytool -keystore android/app/debug.keystore -list -v for your SHA1 value in the Android key. The package name is in android/app/build.gradle android.defaultConfig.applicationId.

The simple existence of this Android key, even though you are not using the actual client ID at all, means it will work. In configure(), use the web application client ID.

This works, how or why does it work?
No one knows, but it works.
Thank you!

@kapilwhaval
Copy link

I have both debug and release keystore but using debug keystore only. I fix this bug by including both sha-1 of debug and release in firebase console.

This worked for me

@RaviThakor
Copy link

No matters weather you are using a firebase or NOT you have to have both the configurations (Android as well as Web client )
Screenshot 2020-09-09 at 5 35 45 PM

//DeveloperError or any login error
https://developers.google.com/identity/sign-in/android/start-integrating#next_steps

Click on Configure a prioject
Select the project.
Fille the required fields.
Voylla, you are good to go.

surprisingly it worked for me thanks a lot bro

@namastefriend
Copy link

Spent many hours on this. Preamble: I started working on an app created by another developer. My fix: added my own SHA1 fingerprint found at C:\Users\Admin.android\debug.keystore to google developer console and firebase console of the project, update google-services.json and the developer error is gone.

@jose2007kj
Copy link

jose2007kj commented May 26, 2021

refer this, #794 (comment)
i spent whole day trying to fix this,
chose the web client(checkout the above mentioned issue, u will understand)

@maxpaynestory
Copy link

You need to create two applications inside google developer console for your react native app. One of type web application and second with type android.

use ClientID of web application with GoogleSignin.configure

react-native-DEVELOPER_ERROR

To get SHA 1 of your react native app on windows run this on root folder

cd android && gradlew signingReport

@vonovak
Copy link
Member

vonovak commented Aug 24, 2021

I am going to close this because it's not an issue with the library but the way the environment is set up, thank you 🙂

@PreetikaSingh
Copy link

I was trying keytool -exportcert -keystore ~/.android/debug.keystore -list -v which of course was giving me a SHA1 key but it was not working, after searching for a while 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, in case some need to know ) so I tried cd android and keytool -exportcert -keystore app/debug.keystore -list -v command and the key I got, worked really well. I hope it will help.

@raosan
Copy link

raosan commented Dec 21, 2022

For those who still get the the DEVELOPER_ERROR after trying all things, try building APK with ./gradlew assembleRelease instead of building AAB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests