使用Google+登录Android应用程序时无法获取授权码:INVALID_SCOPE

5
我正在尝试按照 这些说明 检索授权码以在服务器端使用。服务器的客户端ID与我的Android客户端ID共享同一项目。我可以检索到访问令牌,但无法检索到授权码。
String mScopes = "oauth2:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email";
//String mScopes = "oauth2:server:client_id:314345278679.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email";
Bundle mAppActivities = new Bundle();
mAppActivities.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES, "");
String authorizationToken = GoogleAuthUtil.getToken(LoginActivity.this, mPlusClient.getAccountName(), mScopes, mAppActivities);

取消注释以使用替代范围(检索授权代码而不是令牌)会产生以下错误:
I/GLSUser (15293): GLS error: INVALID_SCOPE my_email_address@company.com oauth2:server:client_id:314345278679.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email

有什么想法吗?

1个回答

11

谢谢!我以为我已经尝试过了,但可能使用了错误的范围。 - Nacho Coloma
3
@Lee,这曾经对我有用,但仅在几天前停止工作,现在会抛出这个错误com.google.android.gms.auth.GoogleAuthException: Unknown。你知道为什么吗?我的权限有问题吗?https://gist.github.com/lawloretienne/7351151 - Etienne Lawlor
1
嗯,我也遇到了一个未知错误,似乎找不到解决方法让它工作。 - Stals

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接