Error: 10: Developer console is not set up correctly (Not Using Firebase) (One Tap sign-up)
Asked Answered
B

9

13

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

Bacteria answered 2/8, 2023 at 22:58 Comment(0)
B
7

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

Bacteria answered 4/8, 2023 at 16:55 Comment(8)
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 AppHandicraftsman
@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"Bacteria
That doesn't change my commentHandicraftsman
@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.Bacteria
you though you had correctly setup, you didn't. this is really not a discussion :-)Handicraftsman
There really isn't a discussion here... I made zero changes and it worked, just reset the SHA-1 key. That's not a case of an incorrect setup, I don't understand why you can't accept the fact...Bacteria
Simply because it cannot be true and I really dislike misinformationHandicraftsman
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.Homograft
D
8

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.

Dissolve answered 6/11, 2023 at 10:56 Comment(1)
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.Illdisposed
B
7

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

Bacteria answered 4/8, 2023 at 16:55 Comment(8)
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 AppHandicraftsman
@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"Bacteria
That doesn't change my commentHandicraftsman
@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.Bacteria
you though you had correctly setup, you didn't. this is really not a discussion :-)Handicraftsman
There really isn't a discussion here... I made zero changes and it worked, just reset the SHA-1 key. That's not a case of an incorrect setup, I don't understand why you can't accept the fact...Bacteria
Simply because it cannot be true and I really dislike misinformationHandicraftsman
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.Homograft
F
6

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

Facelifting answered 20/10, 2023 at 5:54 Comment(0)
I
1

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

Idolah answered 12/12, 2023 at 16:54 Comment(0)
S
1

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

Studio answered 13/2 at 5:22 Comment(0)
I
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

Inexactitude answered 14/10, 2023 at 16:35 Comment(0)
V
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

Valdovinos answered 4/5 at 8:17 Comment(0)
C
0

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

Candycecandystriped answered 25/6 at 15:11 Comment(0)
Q
-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
    }
}
Quoit answered 8/8, 2023 at 16:30 Comment(1)
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.Ferity

© 2022 - 2024 — McMap. All rights reserved.