【问题标题】:Google Oauth 2.0 redirect_uri_mismatch - Port changed on callbackGoogle Oauth 2.0 redirect_uri_mismatch - 回调时端口更改
【发布时间】:2015-10-03 13:11:24
【问题描述】:

我正在使用 Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.AuthorizeAsync() 对 Google 帐户进行身份验证,问题是我登录 Google 帐户后 Google 返回 400 错误:

请求中的重定向 URI:http://localhost:40745/authorize/ 与注册的重定向 URI 不匹配。

但我的 mvc 应用程序在 46423 运行,并且重定向 URI 在开发控制台中设置为 http://localhost:46423/authorize/。我错过了什么?

【问题讨论】:

  • 我不知道。我什么都看不见。没有任何代码很难说
  • Google 对重定向 URI 不要求 https 吗?
  • 原来我在 Google 开发控制台的设置中使用了错误的应用程序类型。当我更改为“已安装的应用程序”时,我从 google 获得了正确的回调 url。

标签: c# .net oauth-2.0


【解决方案1】:

每次调试时重定向 URI 都会发生变化。您应该将 http://localhost/authorize/ 添加到凭据页面的重定向 URI 列表中。

【讨论】:

  • 非常感谢,这对我有用,但使用 localhost/Callback
  • 我不得不使用http://127.0.0.1/authorize/,但除此之外它就像一个魅力!
  • 这无济于事,因为端口每次都是随机的,如果没有包含端口,Google 不会接受。
猜你喜欢
  • 2014-02-09
  • 2015-04-03
  • 2020-11-08
  • 2013-08-09
  • 2021-11-05
  • 2016-02-21
  • 2015-04-28
  • 1970-01-01
  • 2013-08-24
相关资源
最近更新 更多