19

I'm trying to implement Google's One Tap sign-up for my Android app in development. I am following Google's (quite outdated) official guide and so far everything has gone well, up until display of the sign-up UI where the onFailure listener returns an error when I build and run my app:

com.google.android.gms.common.api.ApiException: 10: Developer console is not set up correctly. 

Here's my relevant code:

 oneTapClient = Identity.getSignInClient(this); signUpRequest = BeginSignInRequest.builder() .setAutoSelectEnabled(true) .setGoogleIdTokenRequestOptions(BeginSignInRequest.GoogleIdTokenRequestOptions.builder() .setSupported(true) .setServerClientId(getString(R.string.web_client_id)) .setFilterByAuthorizedAccounts(false) .build()) .build(); // ActivityResultLauncher<IntentSenderReque... (irrelevant to issue) oneTapClient.beginSignIn(signUpRequest).addOnSuccessListener(this, result -> { IntentSenderRequest intentSenderRequest = new IntentSenderRequest.Builder(result.getPendingIntent().getIntentSender()).build(); activityResultLauncher.launch(intentSenderRequest); }).addOnFailureListener(this, e -> { Log.d("/////", "Failed: " + e); }).addOnCanceledListener(this, () -> { Log.d("/////", "Canceled."); }); 

Now, as I have mentioned, I'm following the official guide and I haven't skipped a single step so the first thing I did was Google and research the error. It's at this point that I want to mention, I've reviewed every single answer to the following SO questions: 1 2 3 4 5 6 7 8 9 10 There are several, and I mean several duplicated answers that make it such a pain to find one that helps, people make a big deal about duplicated questions but I think these duplicated answers are really what needs moderation. Oh, and a lot of the answers that include code were usually deprecated and for the Legacy Google Sign In, or some other Google API and not One Tap (I still tried to see if the solutions would work regardless but to no avail).

To save everyone's time, I will address two answers that came up over and over again during my research.

  1. The client ID I input is the 'Web' client ID and not the Android client ID.
  2. SHA-1 was not asked for when making the web client ID but it was when making the android client, I did successfully create and input the correct SHA-1 as per this official guide and this (and more guides for fact-checking).

Some useful information to note: I only have one project, I do not have any variants other than the debug, and I am not using Firebase, this happens every time I run the app on my test device, the application ID is the same as the package name in the manifest, I've also tried regenerating the signed bundle.

If you have any ideas why I may be getting this error please let me know! It's been two days and I feel like I'm out of options...

19 Answers 19

17

Context: I put so much time and effort tinkering at my code and Google cloud console, and searching all over the internet to find a damn solution, I asked questions in SO (this one) and GCC and got no response, I then made a new project and copied exactly what I saw on a video tutorial, there was nothing unexpected but the new project did work so I have no idea what went wrong in my project.

Answer: I didn't find any solutions so I gave up. I shut down my computer, went to sleep, and when I woke up I noticed my SHA-1 key had reset...

I updated the cloud console, ran the code, and it just worked. I'm kinda pissed.

Usually, I'd delete a question like this, but for anyone else who's in dire need like I was, here's what worked for me "turn it off and on".

Sign up to request clarification or add additional context in comments.

10 Comments

Just because you didn't find a solution doesn't mean there wasn't one. You probably didn't setup correctly your OAuth2 credentials in Google Cloud Console: it needs to have the SHA-1 of the certificate you are using to sign your App
@DanieleSegato Please read the part of the question that starts with "To save everyone's time, I will address two answers that came up over and over again"
That doesn't change my comment
@DanieleSegato It should, because I clearly state that I had already correctly set up the credentials using the SHA-1 that I used to sign my app as stated by multiple guides. And this is further collaborated since the fix for me was simply resetting the SHA-1 key itself, which means my method of setting up the Oauth2 credentials had not changed using the SHA-1 key.
I have been facing the same issue and what I can think of in your case it worked because it says that "Note: It may take 5 minutes to a few hours for settings to take effect" . I am going to sleep now and will confirm in the morning if it worked.
|
10

In my case, the solution was quite simple, but it took me a whole lot of time to figure it out.

Basically, I was testing the Google Sign-in logic by building my app directly on a connected device from Android Studio and I was getting OP's error. Unless specified explicitly, the Studio uses a debug.keystore to build an app, by default. One can check by running ./gradlew signinReport in the IDE's terminal. My app's console was set to only allow sign-ins from apps, which are built with a release key.

Solution -> Build a release .apk file and install the app that way on a test device.

I believe this might be useful for someone doing this for the first time like me.

1 Comment

This worked for me. Thank you so much. When I run ./gradlew signingReport it was using ~/.android/debug.keystore . Whereas when I generate an apk it was using the keystore from my key store location.
7

Recently I came across this problem, which wasted valuable hours of me. I have created no. of android apps with google signin, but this time encountered this problem, I did everything right because I have experience in implementing google sign in android apps.

No solution worked for me except one thing.

for some strange reason, Android Studio choosing the debug key location from ~/.config/.android/debug.keystore instead of ~/.android/debug.keystore

I came to know this after running,

 ./gradlew signinReport 

usually, I have a shortcut key to get sha-1 from default debug.keystore

Comments

5

for those who still faces this issue the simplest solution:

go to console credentials page

  • create OAuth 2.0 Client IDs of web application type
  • replace your client id with this

it will work

1 Comment

thank you, this is the correct answer - most upvoted answers claiming it's caused by using incorrect SHA-1 fingerprint are wrong, that is NOT the case, I triple checked everything. Most likely Googlers once again managed to make something unreliable and buggy...
2

I had this issue when running my app in release mode for the first time. I had to go to the Google Console and add a new Auth 2.0 client with the fingerprint of the app in release mode (click Create Credentials and than Auth 2.0 client):

enter image description here

Comments

1

For me using keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android was giving wrong sha1 so I had to use ./gradlew signingreport

Comments

1

In my case, a problem was different on Android.

I had to create Web Application OAuth client, copy it's clientId, and pass it to my serverClientId value, when calling .initialize for google_sign_in package.

Comments

0

I really hope someone would see this and find it useful.. on my side it was a copy paste issue. the key I coppied from google console had \n at the end which made me this bug. this can also explain why people are suffering from this, redoing everything from scratch and then it suddenly works.

.setServerClientId(getString(R.string.google_auth_web_client_id)) make sure that you don't have \n at the end of the string

Comments

0

For me what the error was that I have created the Android oauth client id in one project and web oauth client in another project.

Moving them to a single project solved the issue

Comments

0

I fixed this issue by updating the SHA-1 key in Firebase. Here are the steps I followed to generate the SHA-1 in Android Studio and add it to Firebase:

1. Generate SHA-1 Key in Android Studio:

  • Open Android Studio.
  • Click on the Gradle tab (usually on the right side of the IDE).
  • Select Execute Gradle Task.
  • In the search bar, type ./gradlew signingReport and press Enter. This will generate your SHA-1 and SHA-256 keys.

2. Open Android Studio.

  • Open your Firebase Console.
  • Navigate to Project Settings > General > Your Apps.
  • Scroll down to Add Fingerprint and paste the generated SHA-1 key.

Adding the correct SHA-1 key in Firebase’s Project Settings resolved the "Error: 10" issue for me.

Comments

0

To generate a release signing key SHA-1 for an Android app listed in playstore , you can use the Google Play Console to:

  1. Open the Play Console
  2. Go to the Play App Signing page
  3. Navigate to Release > Setup > App Signing
  4. Copy the SHA-1 fingerprint of your app signing certificate and paste them in your Firebase Project

As Shown below

Comments

0

In my case sign-in worked only when I run the app on my phone by Android Studio, but if I downloaded the app from Google Play - I got that error. To solve it you need to create one more Android OAuth-client on Google Cloud Console with SHA-1 from Play Console (not from gradle signingReport).

Comments

0

I hope my solution will help someone. The same error message appeared for me because in two projects with authentication on Firebase I named the package the same. That is: com.company.project1 and com.company.project2 After changing the "company" for "companysecond", has the problem solved. Because same package name in two projects is not allowed for Firebase authentication.

Comments

0

Its the issue of invalidation of SHA-1 and SHA-256 fingerprints . You may generate new keys by ./gradlew signingReport and load them into firebase console

Comments

0

Google One Tap login and Google Sign In require OAuth 2.0 client ID configuration in the background, although you may not have explicitly used it. Ensure that your OAuth 2.0 client ID configuration in Google Cloud Console matches the signing certificate (SHA-1) used for Google Play App Signing. Update your OAuth configuration to ensure that the package name and signing certificate are correct. I encountered the same problem, the key point being the difference in signature certificates. When you upload AAB to Google Play, Google Play will use its own signature certificate for signing, and you may have used a different signature certificate during development. Therefore, ensure that the OAuth 2.0 client ID configured in Google Cloud Console uses the correct SHA-1 signing certificate (i.e. the certificate used by Google Play), rather than the certificate generated locally.

Comments

0

If you are working with firebase and getting [28444] Developer console is not set up correctly:

In my case I was getting the wrong serverClientId from google-services.json to initialize GoogleSignIn

GoogleSignIn.instance.initialize(serverClientId: 'ldkjasf.....apps.googleusercontent.com') 

Turns out this ID is also not on Cloud Console.

The correct client_id you should get from google-services.json is the one with "client_type": 3

Comments

0

There’s an important difference between App signing key certificate and Upload key certificate in Play Console:

  • Upload key certificate: used by you to sign and upload your releases. Google uses it only to verify the source of the AAB.

  • App signing key certificate: the key Google uses to re-sign your app for distribution. This is what actually runs on users’ devices.

If you use Play App Signing, you must register the App signing key SHA-1 in Google Cloud Console (OAuth 2.0 Android client) for Google Sign-In or One Tap to work.

If you’re not using Play App Signing and manually create your signing key, then your own key’s SHA-1 is what you register instead.

Steps to fix error 10:

  1. Copy App signing key SHA-1 from Play Console → App Integrity

  2. Paste it in Google Cloud → Credentials → OAuth client (Android)

  3. Save and wait a few minutes

No code change or re-upload is needed(if you already created, otherwise please create a new one), the app will now authenticate correctly.

Comments

-1

Today, I suffered from the same problem. Firstly, I tried to make this project using VideoTutorial that you mentioned and also with official files. Then I finished my project and it won't work. Firstly, I thought I should change my project grandle.build file and change it but it still wont work. After thinking few hours, I read this comment and my SHA-1 changed so I updated my key and it worked. Thanks for your help. Also, my grandle files a bit different (I don't know why). But if there are a people which don't sure about their grandle files.

buildscript { repositories { google() mavenCentral() } } plugins { id 'com.android.application' version '8.0.0' apply false id 'com.android.library' version '8.0.0' apply false } allprojects { repositories { google() // Google's Maven repository mavenCentral() jcenter() // Warning: this repository is going to shut down soon } } 

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
-1

OAuth 2.0 Clients
I was implementing Google Sign-In in debug mode (Flutter), and using the credentials of the web application worked. Previously, I was using the credentials for Android.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.