google-services: Google SignIn Fails with code 10 (on Android)
Step 1: Describe your environment
- Device: Xiaomi Redmi Note 3
- OS version: 6.0.1
- MIUI version MIUI Global 9.2
Step 2: Describe the problem:
Throws Error after choosing Google account
com.google.samples.quickstart.signin W/SignInActivity: signInResult:failed code=10
Steps to reproduce:
- Clone the repository and Launch SignIn App (under Android)
- Click SignInActivity
- Click Google Sign In button
- Choose your Google Account
- Logs above error in Logcat
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 35
- Comments: 60 (2 by maintainers)
Google is getting more and more ugly, they’re making simple things complicated. The problem is the third key,
1、the debug key
2、the release key
3、Google Play App signing key
You need THREE keys to figure out ONE Google SignIn.
Does facebook also need three keys? Maybe one day google will need 30 keys.
Hi all. Error code 10 is
DEVELOPER_ERROR
: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes.html#DEVELOPER_ERRORThis almost certainly means you have not properly registered your SHA1 and Package Name in the Google API console: https://developers.google.com/identity/sign-in/android/start
If you are 100% sure that you have done this correctly, make sure that your
GoogleSignInOptions
are correct. In particular, make sure the web client ID (if you’re using it) belongs to the same project where you registered your package name and SHA1.I am going to close this issue since that’s the best advice I can provide with the limited information above.
I just cross-check my SHA1 and discovered a mistake. I have fixed it and the Google sign-in is working as expected. My initial SHA1 was gotten via the terminal while I got the present one via Android studio. Maybe @makeze and @sudarsangp can try something like that if it works. @samtstern thanks for the tip.
This error might happen if you are not using same project at console.developers.google and console.firebase.google.com. If project is same at both console make sure you have add your SHA1 Key properly. Get SHA1 from Android studio.
Open Android Studio Open your Project Click on Gradle (From Right Side Panel, you will see Gradle Bar) Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project) Click on Your Project (Your Project Name form List (root)) Click on Tasks Click on Android Double Click on signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console)) Select app module from module selection dropdown to run or debug your application You also need to get google-services.json from firebase console and put into your project.
I am new to android development and had opted in for google play app signing. My debug release worked fine but when publishing to internal test release it would fail. I realized the app is being resigned upon uploading to google so I registered using signing keys from google play portal and that fixed it. Oddly enough, examining the gradle signing report would only show sha1 for debug builds and not for release builds no matter I had selected the release keystore. Thankfully for now it is not an issue using google play signing.
@mike1128 yeah, Facebook too requires 3 keys if you’ve signed up for Google Play App signing. Refer to this article.
I have also been getting the same error response for the past few days; I have been trying to fixed the problem but no breakthrough and I learnt that the response code (10) means it is a developer problem. I hope someone can profer a solution here.
even if the problem is on the developer side, the error message is so terrible. It’s also confusing, because our app uses only the web application client id, and if the android app SHA1 miss-matches, you still see the issue. A better error message will save people time. This, at least, deserves a fix in the error message or the document.
After release to the store I found signin not working again and it turned out that you need to create a third key with your app’s fingerprint from the Play Store developer console because google re-signs published builds with a different certificate. To sum it up you need to create four OAuth client ids in Google API console: 1 Web client id - this and only this one must be defined in your mobile app for all build types 3 Android client ids (with debug, release and publish fingerprints)
When i release my app to playstore in beta mode the same server_client_ID doesn’t works and i get error in:
ApiException: 10
I’m quite new to android development and in my case it was caused by a wrong package name in
app/build.gradle
file.Although, the tutorial and the configuration page suggests to get the package name from the manifest file, it seems it is checked against the
applicationId
in theapp/build.gradle
file.There are two places to set the package name I’ve found so far:
app/src/main/AndroidManifest.xml
app/build.gradle
android.defaultConfig.applicationId
In my case those two names were different. Earlier I had updated the package name in the first file but forgot to update in the
build.gradle
file.Hope this helps someone.
Hello @rady-ben , what is your way to get sha1 from android studio?
After Uploading to play store, Play store generate its own SH1 which we have to replace in second key in google console.
I hope this might help someone. I was facing the same issue after changing Keystore for my Project due to run into a signing problem.
I was giving SHA1 keys to the firebase console as well as the API console credentials.
I was giving SHA1 generated by circled area but when I put the one from the highlighted one i.e. app module. It worked.
This solved it for me https://www.youtube.com/watch?v=SdYp5JdMvs0
this is the one and absolute answer every one is looking for, thanks
hi @ibnahmadbello I had the same problem when I was using sh1 generated from the commande line. but when I used android studio I get an other key and it work. thank you
When I tried to use the New Google Sign-In API (https://developers.google.com/identity/sign-in/android/sign-in-identity), I found that on system versions lower than Android 10, always Error: com.google.android.gms.common.api.ApiException: 10: Caller not whitelisted to call this API., but there is no such error on Android 10 and Android 11 and above phones. I’m currently using Google Sign-In for Android (legacy) (https://developers.google.com/identity/sign-in/android/sign-in) I’ve also never encountered such an error, I don’t understand Why? My SHA1 is configured correctly
First Create and add Android Fingerprint in Android Client ID
And Create A new Web Application OAuth Client ID
Use Web Application OAuth Client ID 👍👍👍
Thank you. This fixed my problem. After upload first bundle to internal test i started to get an error with google sign in. What i done to fix that problem:
In my case, I tried both from terminal and Android Studio. Both are the same and not working.
Strange, but this worked! I literally used the client_id from oauth_2.0_client_ids for type:webApplication in my android source-code. Earlier, I was using the client_id from oauth_2.0_client_ids for type:android in my android source-code
My issue, root cause is SHA1! we must copy SHA1 at task = “signingReport” and variant = “debugAndroidTest” like this =
For me the issue was that I created the app in debug mode, but used a production keystore, adding the debug keystore in firebase fixed the issue for me:
Documentation does no suggest. there might be some other issue
It can be reused after deleting previous ids. Go to credentials and delete the old
OAuth 2.0 Client IDs
. Then generate a new fingerprint withkeytool -keystore path-to-production-keystore -list -v
in Android Studio terminal and click on the blueConfigure a project
button at sign-in start (step 2). Install the client Id which the wizard will provide you at the end and finally generate a release build signed with the same .jks.