我的谷歌云端点使用Android应用程序和后端编写的python应用程序引擎。当我在开发期间卸载并重新安装我的应用程序时,我开始从后端遇到401错误。在我第一次工作后,后端没有任何变化。所以,
我清理了C:\ Users \ username \ .android中的debug.keystore文件 还有同一目录中的其他文件。生成了 再次调试.keystore文件并获得新的sha1足迹
在Google Apps控制台和重新生成的网页中删除了API项目 client_id&具有新sha1足迹的android client_id
在服务器端代码中使用新的web client_id和android client_id
还更新了android代码
现在安装应用程序后,仍然会看到相同的401错误。我的应用引擎日志显示了这个,
I 2013-04-07 16:45:27.297 Checking for id_token.
W 2013-04-07 16:45:27.299 id_token verification failed: Invalid token signature: eyJhbGciOiJSUzI1NiIsImtpZCI6IjMzMTJkNDc0ZWUzNWRjNWU4YzFhMDE4OTkzOGZkN2E3YmUzYmRlZjYifQ.eyJpc3Mi
I 2013-04-07 16:45:27.299 Checking for oauth token.
我能够根据Cloud endpoints oauth2 error和http://android-developers.blogspot.com/2013/01/verifying-back-end-calls-from-android.html,
收集更多信息我解码了发送到app_engine服务器的id_token,发现它有这些字段,
cid = Android app client_id that I registered in app console for
azp = Android app client_id
aud = web client_id for App engine
iss = accounts.google.com
verified_email = true
email_verified = true
email = account i selected in account picker in android app
exp = a datetime having a value in the future
first_segment = {u'alg': u'RS256', u'kid': u'3312d474ee35dc5e8c1a0189938fd7a7be3bdef6'}
以上值似乎正确,但id_verification失败。不知道为什么。
又问了这个问题。发生这种情况,卸载后我重新安装我的应用程序。 Cloudend点服务抛出无效令牌错误。使用令牌并使用URL验证它。获取如下输出,这意味着令牌有效。
"issuer": "accounts.google.com",
"issued_to": "172895167251-1prp5r093hf2nro5bei2cmc1tqf4aasdu.apps.googleusercontent.com",
"audience": "172895167251.apps.googleusercontent.com",
"user_id": "myuserid",
"expires_in": 3086,
"issued_at": 1365644284,
"email": "emailIselectedinadroidapp",
"verified_email": true
答案 0 :(得分:0)
有趣。如果将id_token发送到tokeninfo端点会发生什么?:
https://www.googleapis.com/oauth2/v1/tokeninfo?id_token= $ id_token