【问题标题】:Google Endpoints - Invalid Token, allowed_client_id using token from OAuth2.0 PlaygroundGoogle Endpoints - 令牌无效,允许 client_id 使用来自 OAuth 2.0 Playground 的令牌
【发布时间】:2016-01-20 23:46:00
【问题描述】:

所以在我的谷歌云项目中,我生成了一个 Web 客户端 ID,并按照 https://developers.google.com/adwords/api/docs/guides/oauth_playground 获取身份验证令牌。

在我的@endpoints.api(allowed_client_ids=) 中,我已将客户端 ID 放入其中。然后在 OAuth2 操场上,我使用我获得的身份验证令牌(例如:Bearer ya29.bwL-f-hz-wcxFq_i-IlEQaJDiinwIP7ad7CaZoRkJRdGrsxxs4Wc9ZeNOgVlhD69zOQk)向 API 发送了一个 http 请求。

但问题是,它没有识别令牌,并说它是一个无效的令牌。为了比较,我将endpoints.API_EXPLORER_CLIENT_ID 放在allowed_clients_ids= 中,当我使用API​​ Explorer 对其进行测试时,它就可以工作了。那我是不是做错了什么?

【问题讨论】:

  • 您是否在操场上指定了任何特定的范围?你能粘贴失败请求的日志吗?
  • googleapis.com/auth/adwords 这是我放入的范围。至于日志,不一定会失败,我就放if endpoints.get_current_user() is None: raise endpoints.UnauthorizedException('')

标签: google-app-engine google-cloud-endpoints oauth2-playground


【解决方案1】:

您已指定自己的客户端 ID 和客户端密码。看到这个 screenshot

【讨论】:

  • 是的,我确实输入了从我的 API 凭据生成的一个
猜你喜欢
  • 2012-05-01
  • 2011-11-27
  • 2016-02-19
  • 2021-11-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-07
  • 1970-01-01
  • 2012-04-09
相关资源
最近更新 更多