gpt4 book ai didi

android - com.google.android.gms.auth.GoogleAuthException : Unknown

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:13:01 25 4
gpt4 key购买 nike

我正在尝试使用 Oauth2 对登录到我的设备的 google 用户进行身份验证。我已经创建了客户端 ID,但无法获得预期的结果。

代码是:

String mScope="oauth2:server:client_id:NNNNNNNNNNN.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/plus.login";

protected Void doInBackground(String... accountName) {

Log.i("Inside on AsynTask:","I am here");
String accName=accountName[0];

try {
token1 = GoogleAuthUtil.getToken(Web_view_demo.this,
accName,
mScope);
Log.i("Inside on AsynTask:","I am here");
} catch (IOException transientEx) {
// Network or server error, try later
Log.e("IO", transientEx.toString());
} catch (UserRecoverableAuthException e) {
// Recover (with e.getIntent())
Log.e("UserRecover", e.toString());
//Intent recover = e.getIntent();
//startActivityForResult(recover, 1);
} catch (GoogleAuthException authEx) {
// The call is not ever expected to succeed
// assuming you have already verified that
// Google Play services is installed.
Log.e("GoogleAuth", authEx.toString());
}

Log.i("Token:",token1);
return null;
}

错误是:

com.google.android.gms.auth.GoogleAuthException: Unknown

非常感谢帮助。

谢谢。

最佳答案

对我来说,以下范围格式有效:

String mScope="oauth2:server:client_id:123456789-dgrgfdgfdgfdgngemhmtfko16f5tnobqphb6v.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/plus.login"

除此之外,如果您缺少在开发者控制台中为您的应用设置的同意屏幕,您最终可能会遇到此 GoogleAuthException:未知。

关于android - com.google.android.gms.auth.GoogleAuthException : Unknown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25131708/

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