【问题标题】:Why I can not authorize API for Google Drive?为什么我不能为 Google Drive 授权 API?
【发布时间】:2018-02-13 02:25:32
【问题描述】:

我正在尝试获取我的 Google 驱动器的访问令牌,因此我打开了 OAuth 2.0 Playground https://developers.google.com/oauthplayground/ 然后我打开配置并输入客户端 ID 和客户端密码,然后我从“Drive API v3”中选择 https://www.googleapis.com/auth/drive 然后单击authorize APIs 但我被重定向到出现错误的空白页面:

  1. 这是一个错误。错误:redirect_uri_mismatch

这是为什么?

【问题讨论】:

    标签: google-drive-api


    【解决方案1】:

    当您创建使用 OAuth 2.0 Playground 的凭据时,请在重定向 uri 中包含 https://developers.google.com/oauthplayground。流程如下。

    • 在凭证处:https://console.cloud.google.com/apis/credentials?project=### project ID ###
      • 点击“创建凭据”。
      • 选择“OAuth 客户端 ID”。
      • 选择“Web 应用程序”。
      • 在“Authorized redirect URIs”中,请输入https://developers.google.com/oauthplayground。
        • 这用作重定向 uri。
      • 点击“创建”,然后点击“创建”。
      • 复制客户端 ID 和客户端密码。

    注意:

    • 在配置中输入客户端 ID 和客户端密码后,当您在 OAuth 2.0 Playground 中单击“授权 API”时,将显示授权屏幕。授权后就可以进行下一步了。
      • 如果显示HTTP/1.1 302 Found,请点击“兑换代币授权码”。这样,您可以检索访问令牌和刷新令牌。

    如果我误解了你的问题,我很抱歉。

    【讨论】:

      猜你喜欢
      • 2015-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多