0

我正在尝试在我的应用程序上使用 google plus 登录,我已经生成了证书指纹和所有证书,但是当我使用它获取令牌时,GoogleAuthUtil.getToken(...)我总是会收到此错误。

错误日志:

09-04 14:04:39.904  13462-13474/? E/GLSUser: Empty consent data

09-04 14:04:39.904  13462-13474/? I/GLSUser: GLS error: InvalidService 

这是我用来尝试获取令牌的代码

String scope = String.format("oauth2:server:client_id:%s:oauth2:%s", CLIENT_ID,     Scopes.PLUS_PROFILE + " " + Scopes.PLUS_LOGIN);
token = GoogleAuthUtil.getToken(this, plusClient.getAccountName(), scope);

有什么建议么?

4

2 回答 2

1

我想通了,您必须在具有证书的 android 应用程序的部分密钥下的 google api 控制台中指定服务器 api 密钥

String scope = String.format("oauth2:server:%s:client_id:%s:oauth2:%s", API_KEY, CLIENT_ID, Scopes.PLUS_PROFILE + " " + Scopes.PLUS_LOGIN);
于 2013-09-04T18:28:14.867 回答
0

您的范围字符串(oauth2)看起来不正确,它应该是:

"oauth2:server:client_id:<server client-id>:api_scope:<scope1> <scope2>";

在哪里<scope1>

https://www.googleapis.com/auth/plus.login

<scope2>等等是您授权的其他范围。

于 2013-09-04T18:24:59.647 回答