所以我实施谷歌加登录到我的应用程序...我的执行非常紧密遵循给出的例子here。我和他之间最大的区别是我有一套我需要的范围更大的范围。建设我的plusclient当我指定以下范围:Android PlusClient实现&得到一个令牌
"https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.me https://www.google.com/m8/feeds https://www.googleapis.com/auth/userinfo.email"
后下了线我onConnected方法我试图为了从我的会议上得到的accessToken传递到我们的服务器,我们做真正的肉&马铃薯工作。
GoogleAuthUtil.getToken(SplashActivity.this, mPlusClient.getAccountName(), "oauth2: https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.me https://www.google.com/m8/feeds https://www.googleapis.com/auth/userinfo.email")
这确实产生了一个accesstoken。 YIPPEE!对?不。当我们尝试并使用此令牌时,似乎它与我们的应用程序无关。通过谷歌tokeninfo端点上运行的令牌时,我们相处的
{
"issued_to": "608941808256-43vtfndets79kf5hac8ieujto8837660.apps.googleusercontent.com",
"audience": "608941808256-43vtfndets79kf5hac8ieujto8837660.apps.googleusercontent.com",
"user_id": "107245641469745809180",
"scope": "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.profile https://www.google.com/m8/feeds https://www.googleapis.com/auth/userinfo.email",
"expires_in": 3577,
"email": "[email protected]",
"verified_email": true,
"access_type": "online"
}
是ISSUED_TO值不与任何我们的客户的id的匹配线的东西。根据this blog post的最后部分,Google无法将此令牌请求与我们的项目匹配。然而,在我们的API控制台中,我确实在那里有用于android的SHA指纹,它确实与包名称用分号分隔。没有拼写错误。我等了几个小时,看看这是否是一个传播问题。我还添加了SHA指纹,以及为我们的调试密钥库创建clientid的东西。无论我们是否从eclipse中导出已签名的apk或直接运行它,我们都有同样的问题。
这让我疯狂。我不知道该在哪里转身。
作为一个例子,使至
呼叫googleapis.com/plus/v1/people/me/people/visible?access_token=TOKEN_HERE当&的maxResults = 100 & pageToken = & ALT = JSON & ORDERBY =最好
我得到
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured"
}
],
"code": 403,
"message": "Access Not Configured"
}
}
,因为谷歌因为种种原因没有与我的项目,令牌关联。
这使我疯狂。我似乎无法解决它。 – frostymarvelous 2015-03-18 09:23:47