Google sign in failed com google android gms common api apiexception 10

Why do I get com.google.android.gms.common.api.ApiException: 10:?

22 Answers 22

Certain Google Play services (such as Google Sign-in and App Invites) require you to provide the SHA-1 of your signing certificate so we can create an OAuth2 client and API key for your app.

If you are using Firebase and try on the debug app :

1. First, get your SHA-1 debug key :

  1. Click on Gradle (From Right Side Panel, you will see Gradle Bar)
  2. Click on Tasks
  3. Click on Android
  4. Double Click on signingReport (You will get SHA-1 and MD5 )

2. Add new credentials to API Console

  1. Go here https://console.developers.google.com/apis/credentials
  2. Create new OAuth Client ID
  3. Name : Android client (for debug) (example)
  4. Signing-certificate fingerprint : Copy paste you SHA-1 debug key
  5. Put your package name then saved

3. Add your key to your Firebase project :

Go to Project settings -> SHA certificate fingerprints -> Add SHA-1 key of debug app.

Then you can update your google-services.json file in your Android project.

It’s works for me.

) and SHA1 were generated from default in the android root.

This status code means that you are providing unknown server client id. In https://console.developers.google.com/apis/credentials in your project you might need to generate: OAuth client ID -> Web Application and use this web application client id here:

I have solved this problem using these steps:

1). Goto https://console.developers.google.com/ and delete (Android Client) if it is created.

2). Click on Create Credential and click on OAuthClientID and select android

3). copy and paste your SHA 1 fingerprint

4). type your package name then saved

5). Goto console.firebase.com

6). download google-service.json move it into your project into app directory

7). Open google-service.json and find out client id type 3 and use it as default_web_client_id

The ApiException Error Code 10 is a developer error. You get this error when your firebase app is not well configured. One sure case is when you do not supply the SHA1 fingerprint for your android app when you want to use Firebase authentication with Google Signin. (It is a requirement for Google Signin). So supply the SHA1 fingerprint, download the google-services.json configuration file to your app folder and build. You should be good to go.

Google sign-in is automatically configured on your connected iOS and web apps. To set up Google sign-in for your Android apps, you need to add the SHA1 fingerprint for each app on your Project Settings.

My problem was trying to use Google Sign-In yet I had accidentally enter the wrong SHA1 in Firebase. Try running Gradle > Your app name > Tasks > android > signingReport , get your SHA1 key and compare it with the one on Firebase. If they are different, change the Firebase SHA1 key to match the one you got from the signingReport. Don’t forget to also download the google-services.json afterwards.

I have this thing in 2-3% of the occasions in production and it works seamlessly for everyone else.

Given the sheer amount of problems and differing answers this is causing, it’s fair to say that this is a problem on behalf of firebase. They’ve implemented a catch-all error routine that is just bad api design. The api must point to the problem where it fails.

Читайте также:  Android fragments settings in android

A long term solution is to convince firebase that this is bad-api design and they need to do better.

We’re strong together.

Please write a support ticket to firebase roughly with this:

i have a com.google.android.gms.common.api.ApiException: 10 in my app.

The problem for me — and for a lot of people all over the forums — is that your api seems to have a catch-all error routine that roughly speaking is saying «something went wrong, please fix it».

You could release your support team and a lot of people from headache if you would fix this.

The API should be able to figure what’s wrong and give a better error message from the context where it occurs.

It’s really a burden and I think that since firebase has a quasi-monopoly on these matter on Android it’s your obligation to do better.

While this is obviously not your fault, I’d like to encourage you to escalate this problem.

It’s fundamentally bad api design and harms an otherwise great product.

Источник

Flutter and google_sign_in plugin: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null)

The dialog (Google form) for the credentials is opened successfully, but after I fill my credentials I’m getting this error. I followed the instructions from here. Created a Firebase project, enabled the Google Drive API (that’s what I need for now) from the Google APIs Console.

The code throwing the exception:

That’s the stack trace:

The version of the google_sign_in plugin is 4.0.0.

That’s the output of flutter doctot -v:

Any help will be much appreciated. Thanks!

39 Answers 39

I run into the same issue just now. This might happens if you are running on debug and you did not register a SHA fingerprint in firebase. I solved it by generating a debug.keystore and registering it inside the app on Firebase. Don’t forget to download the new google-services.json after that. See also this.

Edit If you are not able to use authenticate in release mode try the following:

-Add the SHA certificate fingerprints of the release key.

keytool -exportcert -list -v \ -alias -keystore

For more details on that see here on the section «get release certificate» https://developers.google.com/android/guides/client-auth

If your authentication is still not working, probably it is because you downloaded the app from Playstore and you enabled the «App Signing by Google Play Feature» Then for this case, go to play store publish console and go to app signing under release management. There you will find the SHA certificate fingerprint to register in Firebase console.

The following solution works in flutter project:

Step 1: Generate SHA1 and SHA256 keys.
Step 2: Add both the SHA1 and SHA256 to firebase. (in you app settings)
Step 3: Download google-services.json to android/app in your project folder.
Step 4: In your terminal run the command flutter clean .
Step 5: Run your flutter app.

I spent ages trying to fix this.

1. Open grade.properties This file is found under: <>/android/gradle.properties

Читайте также:  Воздушные бои для андроида

2. Add the following argument to ‘org.gradle.jvmargs’ as shown in the screenshot.

3. Right click on ‘gradlew’ and go to ‘Open in Terminal’ This file is found under <>/android/gradlew

4. Type in the following command.

If did not work first try second command:

5. Wait for the compilation to finish and your SHA keys should be printed out for you.

Use these keys to authenticate your app in https://console.firebase.google.com/

Open the Firebase console and click on the settings icon.

You will see the list of the apps connected to your Firebase project

  1. Open terminal inside your flutter project
  2. cd android
  3. ./gradlew signingReport or gradlew signingReport
  4. Paste your SHA1 key
  5. Download and replace the google-services.json
  6. flutter clean
  1. Configure your Firebase project
  2. Select IOS
  3. Enter your Bundle ID
  4. Download credetials
  5. Download and replace GoogleService-info.plist

Add this to your info.plist

When I came across this problem, I tried all other solutions described in this post. None of these worked. Eventually I figured it out: In my situation I had to make sure to have my «support email» set.

Additional steps you might have to take in order for google_sign_in to work:

    If you could run Google Sign In during debug but NOT in release, there is a high chance that you did not add your release key’s SHA1 and SHA256 to firebase. To get the release key’s SHAs, use keytool -list -v -keystore

/key.jks -alias key

You should end up with total of at least 6 SHA credentials: 2 from the debug key, 2 from Google Play linking, and 2 from the release key. Note that you do not need to redownload the google-services.json file after adding the release SHA credentials to firebase.

For me I didn’t need to add extra SHAs, I realized I didn’t enable the Google Sign-in method in the Authentication tab in Firebase console

I found a solution for the error com.google.android.gms.common.api.ApiException: 10 : I solved it by adding more keys to the firebase. initially I thought it was stupid and useless, then in the end it turned out to be the solution (I added up to 10 SHA, don’t worry if that’s a lot).

  1. Where did I find all these keys?

I found all these keys by entering the android folder and typing the command ./gradlew signingReport (I use linux, it also works on mac. For windows the command is gradlew signingReport )

After that, he printed out a very long list of keys in my terminal, and I took all the ones that were different, that were at the top of the list.

Note: you will get all the keys (both debug and release) of each package of the app, but rest assured that all those of the packages are the same and only for debugging (so you will have to take these same keys only once)

Once you have all the app keys, go to your project’s Firebase settings, scroll down and add any keys you found. After that, you will need to download the google-services.json file again and run a flutter clean in your project’s local folder on your computer.

Читайте также:  Chat partner для андроид

Now you can build your app and see if it works!

I hope this could help someone.

If your released app is not working properly, and you are using Google Play Signing, Copy the SHA from your play store account, the one from your local key will not work

«Flutter clean» its the piece that everybody is missing after register the SHA1 in Firebase Console!

You have missed configuration step enable google login on firebase.

Google sign-in is automatically configured on your connected iOS and web apps. To set up Google sign-in for your Android apps, you need to add the SHA1 fingerprint for each app on your Project Settings.

✅ Just complete these enough steps below

  1. Enable Google Auth Method
  2. Configure certificate fingerprints in your current project at project-level setting . How to Generate certificate.
  3. Select email for Project support email
  4. Download google-service.json into your project.
  5. Run flutter clean
  6. start flutter run

For platform exception 10, try this:

  1. Generate a new SHA1 fingerprint on your machine,
  2. Go to your firebase android app setting in Firebase Console
  3. Click on add new fingerprint in your android app settings
  4. Paste the new SHA1 fingerprint into the field
  5. Generate a new json config file
  6. Replace the config file in android directory
  7. Run flutter clean
  8. Run your project

The answer that given early are right. None of them are false. But if you still face the error PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null) . One thing that your should check is your OAuth 2.0 Client IDs

  1. Go to : https://console.cloud.google.com/apis/credentials
  2. Select your project on the top left screen
  3. Create Client ID base on your platform (iOS or Android)
  4. Just follow the next steps

Once you successfully generate the client ID, then your application will works as expected.

But first, make sure you have regitered your SHA-1 , package id email support and has been download the google service json from your firebase console project.

One reason that you might be experiencing this error is if you did not fill out google’s OAuth consent form. This is a new change to Firebase.

Here are the steps you need to follow to fill out the consent form for your app:

  1. Navigate to the google api console (currently at https://console.developers.google.com), make sure you are logged into your account which your firebase project is created under.
  2. Select your project from the «select a project» dropdown in top left of the developer console.
  3. In the left hand pane travel to «credentials» and then switch to the «OAuth consent screen».
  4. Under «Application name» enter your application’s public name
  5. Under «Application logo» upload a local image file of your application
  6. Under «Support email» enter the same support email listed in your firebase application.
  1. Scroll down and fill out the «Application Homepage Link», «Application Privacy Policy Link», and «Application Terms of Service Link» by adding http:// before the authorized domain which your firebase app lives at.

These steps worked for me! While the link may not still exist, I’d like to reference the source of this solution here

Источник

Оцените статью