问:Google OAuth 2 错误 400:redirect_uri_mismatch 但是重定向 uri 是合规的并且已经在 Google Cloud Console 中注册

Q: Google OAuth 2 Error 400: redirect_uri_mismatch but redirect uri is compliant and already registered in Google Cloud Console

我正在使用 next-auth 开发一个 NextJS 应用程序,Google Oauth 2 作为其身份验证提供程序。生产版本在 Heroku 上是 运行。当尝试登录我的生产版本时,Google OAuth 给了我 "Error 400: redirect_uri_mismatch"。通常这很容易解决,除非确切的 uri 已经在 Cloud Console 中注册。

.

我也尝试过添加许多不同的 uri 排列,但这没有帮助。

此问题未由 11485271 or 69151061 解决。

问题错误:

错误 400:redirect_uri_mismatch

您无法登录此应用,因为它不符合 Google 的 OAuth 2.0 政策。

如果您是应用开发者,请在 Google 云控制台中注册重定向 URI。

请求详细信息 如果您是应用开发者,请确保这些请求详细信息符合 Google 政策。 redirect_uri: https://middcourses2.herokuapp.com/api/auth/callback/google

And here is a link to the list of authorized domains in GCP.

已解决!因此,出于某种原因,Google 在我设置了这些环境变量后更改了我的客户端 ID 和客户端密码。一旦我注意到变化并输入新值,它就可以正常工作了。