Skip to main content
 首页 » 编程设计

c#之Google Oauth 2.0 redirect_uri_mismatch之端口在回调时更改

2024年02月06日15qq号

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

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

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

请您参考如下方法:

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