无法获取授权code与Google+登录功能对于Android:INVALID_SCOPE [英] Unable to get Authorization Code with Google+ Sign-in for Android: INVALID_SCOPE

查看:1664
本文介绍了无法获取授权code与Google+登录功能对于Android:INVALID_SCOPE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取授权code以下的这说明。服务器的客户端ID赞同我的Andr​​oid客户端ID在同一个项目。

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.

我可以检索访问令牌,而不是授权code:

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);

取消注释使用替代范围(检索授权code,而不是一个令牌)产生以下错误:

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

任何想法?

推荐答案

您错过的https://www.googleapis .COM /认证/ plus.login 从你的作用域。我想你的code和获得INVALID_SCOPE没有plus.login,但它工作正常。

You're missing https://www.googleapis.com/auth/plus.login from your scopes. I tried your code and get INVALID_SCOPE without plus.login, but it works fine with.

这篇关于无法获取授权code与Google+登录功能对于Android:INVALID_SCOPE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆