googlesamples / google-services

A collection of quickstart samples demonstrating the Google APIs for Android and iOS
https://developers.google.com
Apache License 2.0
3.08k stars 2.53k forks source link

Google SignIn Fails with code 10 (on Android) #579

Open tangxianqiang opened 1 year ago

tangxianqiang commented 1 year ago

Device: Pixel 3xl OS version: Android 12 SDK version:33 [Android] Google Play Services version:4.3.15

Describe the problem: google SignIn always return error code 10 in these days on my release version. (debug apk is ok) SHA1 all the same on google play console test, google cloud and firebase ( SHA1 come from release.jks)

package name is the same too GOOGLE_LOGIN_CLIENT_ID is the right,copy from google Oauth

Steps to reproduce:

  1. click login
  2. select a user

Observed Results:

return error code 10, no more other information

Expected Results:

login success

Relevant Code:

  val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(GOOGLE_LOGIN_CLIENT_ID)
            .requestScopes(Scope(Scopes.EMAIL))
            .requestId()
            .build()
tangxianqiang commented 1 year ago

it will return error 10 If the requestIdToken of web client id is fill wrong. Is it right?

luoyiee commented 1 year ago

如果Web客户端id的requestIdToken填写错误,会返回错误10。这样对吗?

firebase中的web client id需要正确配置,不仅仅是Sha1的问题

tangxianqiang commented 1 year ago

如果Web客户端id的requestIdToken填写错误,会返回错误10。这样对吗?

firebase中的web client id需要正确配置,不仅仅是Sha1的问题

使用debug版本,google 一键登录没有问题,说明web client id 使用是对的。现在是release的apk,无法登录,报10,我认为我配置的release的SHA1 肯定是对的,控制台打印、play console,cloud 都是对应上的

luoyiee commented 1 year ago

你发的代码是旧的登录方式,旧模式我这里是配置了firebase--Authentication中的sha1和web_server_id,如果不配置我这里是会报10的 。 新方式一键登录可能不需要配置firebase就能成功,release和debug在我这里没区别

企业微信截图_1694680355431