Google sign in failed com.google.android.gms.common.api.ApiException: 10:

只愿长相守 提交于 2019-11-27 08:14:35

Basically problem is in the SHA1 key put on console please regenerate it and put again properly same project.

1)As the answers, make sure that your actual signed Android apk has the same SHA1 fingerprint as what you specified in the console of your Firebase project's Android integration section (the page where you can download the google-services.json)

2)On top of that go to the Settings of your firebase project (gear icon right to the Overview at the top-left area. Then switch to Account Linking tab. On that tab link the Google Play to your project.

I was facing the same issue, After checking around for a solution, from regenerating the finger print to linking the app on firebase to the Google play console and publishing the signed apk, the issue was actually because I was using the release SHA-1 on the firebase console.

  • If you are still on debut mode, use the debug.keystore SHA1
  • Only use the release SHA1 if you are on production mode

https://developer.android.com/studio/publish/app-signing.html

In My case, There is no problem with SHA-1

I have done GoogleAuth using Firebase.

I forgot to add implementation 'com.firebaseui:firebase-ui-auth:4.3.1'

And I put my own key instead of R.string.default_web_client_id, So that was the problem. I added above dependency and replace R.string.default_web_client_id with my own key.

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();

When using App Signing by Google Play and Firebase, you need to add the SHA-1 fingerprint of the App signing certificate (found on Google Play Console/ Release Management/ App signing certificate) to the Firebase Console/ Settings/ SHA certificate fingerprints

If you have all configuration valid in firebase like SHA-1 and you have imported right google-services.json file still you are getting error then add the support email in firebase console

You have to add support email in fire base console Go to Project-> Setting -> General -> Public setting add Support Email

I am not sure if this is the cause, but we might need to use the Web Client ID in the Android App before publishing it, read the following article,

https://android-developers.googleblog.com/2016/03/registering-oauth-clients-for-google.html

i was dealing with this problem for 2 days ! the problem was the clientId i used, was android type while i had to use web Aplication type Clientid . please consider this if you have the same problem ;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!