react-native-google-signin / google-signin

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

`DEVELOPER_ERROR` from the Android app uploaded to Google Play store #1218

Closed bglgwyng closed 10 months ago

bglgwyng commented 10 months ago

I verified that Google sign-in with this library functioned correctly in development. However, the production build, which was uploaded to the Google Play Store, consistently failed to sign in and threw a 'DEVELOPER_ERROR.'

I researched numerous posts addressing this issue, most of which were resolved by utilizing a valid 'google-services.json' file and ensuring the correct SHA-1 fingerprint was set on Firebase. I implemented both solutions. Upon inspecting the installed APK on my test device, I confirmed that the SHA-1 fingerprint matched the one I registered in the Firebase console. Consequently, I have ruled out the possibility of an incorrect SHA-1 fingerprint causing the problem.

Now, I am uncertain about what I might have done incorrectly. I am using Expo and building the production version with EAS. Could this be relevant to the issue?

vonovak commented 10 months ago

Hello @bglgwyng, thank you for sponsoring!

DEVELOPER_ERROR is always a misconfiguration issue: either your package name or the SAH1 hash you entered in firebase (or google cloud console) is wrong. You should be able to find the SHA in play store console, as seen here https://github.com/react-native-google-signin/google-signin/blob/master/docs/android-guide.md#google-login-does-not-work-when-downloading-my-app-from-the-play-store

If there are more SHAs, add them all to firebase.

Please let me know if that helps

Thank you 🙂

bglgwyng commented 10 months ago

Thank you for your brief reply! There's one thing I forgot to report. Once I removed all the SHA1 fingerprints from my Firebase app to see what happened. What's weird is that the development build succeeded at signing it, while the fingerprints of it would also have been removed. So I'm confused if the modification on fingerprint values in Firebase console really affects the behavior. Is there a delay in applying the change? What would be the better way to debug this behavior?

bglgwyng commented 10 months ago

Also, I copied the installed APK from my device and examined its signature by

keytool -printcert -jarfile myapp.apk

And it was the same as the one registered on my Firebase project. From my understanding, this indicates that there's no chance of having problems with SHA1 fingerprints. Or am I missing something else?

vonovak commented 10 months ago

hello, provided that you downloaded the apk from the store, keytool / apksigner will be giving you the correct information.

Firebase is only a proxy to google cloud console, so please double-check there. If that doesn't help then I don't think I can debug this over comments.

Good luck :)))

bglgwyng commented 10 months ago

@vonovak You saved me! https://github.com/react-native-google-signin/google-signin/blob/master/docs/android-guide.md#google-login-does-not-work-when-downloading-my-app-from-the-play-store This document has the right solution for me. To be more specific, this part.

If you are not using Firebase, and your app is enabled for "Google Play App Signing": Go to "https://console.developers.google.com/" -> click "Credential" in the right panel -> Find "Client ID" for type "Android" under "OAuth 2.0 Client IDs" section -> Edit -> replace "SHA-1 certificate fingerprint" with the one from App -> Release (in left sidebar) -> Setup -> App integrity -> App signing key certificate.

I found that the OAuth2 ID for Android in GCP doesn't have the valid SHA1 fingerprint value. So I copied the SHA1 fingerprint from my Google Play Store console into it. And the problem was gone.

But one thing weird is that I've been using Firebase and I suppose that at one moment, Firebase stopped reflecting its fingerprint value to GCP. Not sure if it's because of my mistake or just Firebase's wrong behavior.