【问题标题】:Google redirect_uri with a path not working路径不起作用的 Google redirect_uri
【发布时间】:2018-11-23 01:58:33
【问题描述】:

我正在使用 redirect_uri 来选择在 Google 身份验证后打开的页面。它在开发中运行良好,但在生产中却不行(两者都使用相同的 OAuth 客户端 ID)。我在客户端 ID 的授权重定向 URI 部分中添加了 localhost 和生产链接。

生产错误看起来像这样(我正在用 test.com 替换我的实际域)。我很困惑,因为错误中的链接与我添加到授权重定向 URI 的链接相匹配:

 Error: redirect_uri_mismatch. The redirect URI in the request,
 https://www.test.com/target does not match the ones authorized for the OAuth client. 

所以这行得通:

const gapiClientConfig: GapiClientConfig = {
  client_id: CLIENT_ID,
  discoveryDocs: [ DISCOVERYDOCS ],
  scope: [ SCOPES ].join(' '),
  ux_mode: 'redirect',
  redirect_uri: 'http://localhost:8888/targetPage
};

但这不是:

const gapiClientConfig: GapiClientConfig = {
  client_id: CLIENT_ID,
  discoveryDocs: [ DISCOVERYDOCS ],
  scope: [ SCOPES ].join(' '),
  ux_mode: 'redirect',
  redirect_uri: 'https://www.test.com/targetPage
};

如果我从链接中删除路径,它会起作用。

redirect_uri: 'https://www.test.com'

【问题讨论】:

    标签: google-app-engine google-oauth


    【解决方案1】:

    似乎对 Google Cloud Console 中 OAuth 客户端设置的更改可能不会立即生效。现在一切正常。

    【讨论】:

      猜你喜欢
      • 2013-07-06
      • 1970-01-01
      • 2018-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-20
      • 2011-01-02
      相关资源
      最近更新 更多