【问题标题】:Getting invalid_client response while creating token request创建令牌请求时获取 invalid_client 响应
【发布时间】:2013-06-14 19:38:26
【问题描述】:

我正在按照 google 提供的文档使用 API 访问 gmail。根据谷歌文档,我们需要访问令牌来管理 gmail。

所以我尝试通过阅读下面给出的文档链接来创建访问令牌。

Link1 :- developers.google.com/accounts/docs/OAuth2WebServer,基于此文档创建 URL1。

Link2 :- code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough,基于此文档创建 URL2。

URL1 :- https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=%2Fprofile&redirect_uri=http%3A%2F%2Flocalhost%2Fstudy%2Fgmail-access%2Foauth2-php-samples%2Foauth2.php&response_type=code&client_id=XXXXXXXXXXXXXXX.apps.googleusercontent.com&approval_prompt=force

URL2 :- https://accounts.google.com/o/oauth2/auth?client_id=XXXXXXXXXX.XXXXapXps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%2Fstudy%2Fgmail-access%2Foauth2-php-samples%2Foauth2.php&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F

我在两个请求中都收到了无效的客户端响应。请帮我找出客户端响应无效的原因。

【问题讨论】:

    标签: gmail google-api google-oauth google-authentication


    【解决方案1】:

    我不确定 URL1 的问题,但在替换重定向 uri 和客户端 id 后令牌正确

    URL2 不正确,因为我使用了 Web 应用程序的客户端 ID,而不是已安装的应用程序。

    据我所知,https://code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough 中的说明有助于为已安装的应用程序而不是 Web 应用程序制作令牌。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-18
      • 1970-01-01
      • 1970-01-01
      • 2018-12-25
      • 2018-06-11
      • 2022-07-07
      • 2022-06-23
      • 2020-11-16
      相关资源
      最近更新 更多