Google Oauth 2.0 redirect_uri_mismatch - 回调时端口更改

Mar*_*ren 2 .net c# oauth-2.0

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

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

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

Ila*_*ies 6

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

  • 我必须使用“http://127.0.0.1/authorize/”,但除此之外,它就像一个魅力! (5认同)