gpt4 book ai didi

android - 状态代码 12501 正在使用谷歌登录进行身份验证

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:04:43 55 4
gpt4 key购买 nike

我正在使用以下代码行进行 G+ 登录 android 集成。

在应用程序 build.gradle 中:

编译 'com.google.android.gms:play-services-auth:8.4.0'
编译 'com.google.android.gms:play-services-plus:8.4.0'

在主 Activity 中:

 GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.com")
.requestProfile()
.build();

AppCompatActivity appCompatActivity = (AppCompatActivity) context;

googleApiClient = new GoogleApiClient.Builder(context)
.enableAutoManage(appCompatActivity, this)
.addConnectionCallbacks(this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addApi(Plus.API)
.build();

我还在应用级别添加了“google-services.gson”文件。我还制作了 web 应用程序,并将 client-id 用于 requestIdToken() 参数。

requestIdToken(网络应用程序的客户端 ID)。

编写此代码后,我仍然收到状态代码 = 12501 作为响应,并且 tokenId = null。

我也读过this link .但找不到任何解决方案。

最佳答案

您需要在 google-services.json 文件中添加已签名和调试 client_id 的凭据,如下所示:

"oauth_client": [
{
"client_id": "<your-client-id>",
"client_type": 1,
"android_info": {
"package_name": "<your-package-name>",
"certificate_hash": "<hash>"
}
},
{
"client_id": "<your-client-id-2>",
"client_type": 1,
"android_info": {
"package_name": "<your-package-name-2>",
"certificate_hash": "<hash-2>"
}
}
]

关于android - 状态代码 12501 正在使用谷歌登录进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34600278/

55 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com