[英]Unable to get Authorization Code with Google+ Sign-in for Android: INVALID_SCOPE
I am trying to retrieve an authorization code to use in my server side following these instructions . 我正在尝试按照这些说明检索要在我的服务器端使用的授权代码。 The client ID of the server shares the same project of my Android Client ID.
服务器的客户端ID共享我的Android客户端ID的同一项目。
I can retrieve the access token, but not the authorization code: 我可以检索访问令牌,但不能检索授权代码:
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);
Uncommenting to use the alternative scope (to retrieve an authorization code instead of a token) produces the following error: 取消注释以使用备用范围(检索授权代码而不是令牌)会产生以下错误:
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
Any ideas? 有任何想法吗?
You're missing https://www.googleapis.com/auth/plus.login from your scopes. 您缺少来自示波器的https://www.googleapis.com/auth/plus.login 。 I tried your code and get INVALID_SCOPE without plus.login, but it works fine with.
我尝试了你的代码并获得INVALID_SCOPE而没有plus.login,但它可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.