【问题标题】:id_token verification failed: Invalid token signature: in google cloud endpointsid_token 验证失败:令牌签名无效:在谷歌云端点中
【发布时间】:2013-03-29 22:57:08
【问题描述】:

我让谷歌云端点与一个用 python 应用引擎编写的 android 应用和后端一起工作。当我在开发过程中卸载并重新安装我的应用程序时,我开始从后端遇到 401 错误。在我第一次工作后,后端没有任何变化。所以,

  1. 我清理了 C:\Users\username\.android 中的 debug.keystore 文件和 也是同一目录中的其他文件。重新生成 再次 debug.keystore 文件并获得新的 sha1 足迹

  2. 在谷歌应用程序控制台中删除 API 项目并重新生成网页 具有新 sha1 足迹的 client_id 和 android client_id

  3. 在服务器端代码中使用了新的 web client_id 和 android client_id

  4. 还更新了android代码中受众范围内的android cliend_id

我现在安装应用程序后,仍然看到相同的 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 errorhttp://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 Points 服务抛出无效令牌错误。使用令牌并使用 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

【问题讨论】:

标签: android google-app-engine google-oauth google-cloud-endpoints


【解决方案1】:

有趣。如果将 id_token 发送到 tokeninfo 端点会发生什么?:

https://www.googleapis.com/oauth2/v1/tokeninfo?id_token=$id_token

【讨论】:

  • 谢谢..当我再次遇到错误时会试试这个。直到现在还没有遇到过这个错误。
猜你喜欢
  • 2017-07-06
  • 1970-01-01
  • 1970-01-01
  • 2019-06-14
  • 2019-11-19
  • 2017-05-19
  • 2014-10-08
  • 2021-08-10
  • 1970-01-01
相关资源
最近更新 更多