![](/img/trans.png)
[英]getting Google oauth authorization token from Android- return with invalid_scope/ Unknown error
[英]Unable to get Authorization Code with Google+ Sign-in for Android: INVALID_SCOPE
我正在尝试按照这些说明检索要在我的服务器端使用的授权代码。 服务器的客户端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
有任何想法吗?
您缺少来自示波器的https://www.googleapis.com/auth/plus.login 。 我尝试了你的代码并获得INVALID_SCOPE而没有plus.login,但它可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.