Ami*_*mit 4 google-api google-plus google-play-services
我试图在我们的应用程序中实现G +登录,但是,尽管已经反复更新客户端ID,并重新创建一个新的,我继续收到错误说
I/GLSUser? GLS error: INVALID_CLIENT_ID myemail@domain.com oauth2:https://www.googleapis.com/auth/plus.login
Run Code Online (Sandbox Code Playgroud)
不确定是什么问题.我可以看到帐户列表弹出窗口,其他一切似乎也可以正常工作.我也仔细检查了我的客户端ID.
[编辑]
这是我正在使用的代码
private void getGoogleAccessToken() {
Bundle appActivities = new Bundle();
appActivities.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES, "AddActivity BuyActivity");
String scopes = "oauth2:server:client_id:number-randomness.apps.googleusercontent.com" + ":api_scope:"+ Scopes.PLUS_LOGIN;
mGoogleToken = null;
try {
mGoogleToken = GoogleAuthUtil.getToken(this, mPlusClient.getAccountName(), scopes, appActivities);
} catch (IOException transientEx) {
// network or server error, the call is expected to succeed if you try again later.
// Don't attempt to call again immediately - the request is likely to
// fail, you'll hit quotas or back-off.
Crouton.makeText(this, R.string.google_bad_boy, Style.ALERT).show();
} catch (UserRecoverableAuthException e) {
// Recover
Crouton.makeText(this, R.string.google_bad_boy, Style.ALERT).show();
} catch (GoogleAuthException authEx) {
// Failure. The call is not expected to ever succeed so it should not be
// retried.
Crouton.makeText(this, R.string.google_not_allow_login, Style.ALERT).show();
} catch (Exception e) {
Crouton.makeText(this, R.string.google_not_allow_login, Style.ALERT).show();
// throw new RuntimeException(e);
}
}
Run Code Online (Sandbox Code Playgroud)
[编辑2]
看起来我在这段代码中获得了一个不成功的Activity结果:
mGoogleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!mPlusClient.isConnected()) {
mConnectionProgressDialog.show();
if (mConnectionResult != null) {
try {
mConnectionResult.startResolutionForResult(SplashActivity.this, REQUEST_CODE_RESOLVE_ERR);
} catch (IntentSender.SendIntentException e) {
// Try connecting again.
mPlusClient.connect();
}
} else {
mPlusClient.connect();
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
Pac*_*Sky 17
确保您已在Google Developer Console中的项目设置中更新了同意屏幕上的详细信息.您需要确认您的(开发人员)电子邮件地址,并为您的应用程序提供一个名称,该名称将在权限确认屏幕中显示给用户.
虽然Google+快速入门指南(https://developers.google.com/+/quickstart/android)未明确谈论此问题,但您需要执行此操作(非常简单),否则您将收到INVALID_CLIENT_ID错误设备.
| 归档时间: |
|
| 查看次数: |
2355 次 |
| 最近记录: |