oauth - 从 Google 获取登录和重定向问题

标签 oauth google-oauth google-developers-console next-auth

尝试为我的应用程序设置身份验证,一切似乎都正常工作,但是当我尝试对其进行测试时,我收到了这条错误消息

Authorization Error Error 400: redirect_uri_mismatch The redirect URI in the request, http://localhost:3000/api/auth/callback/google, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/${your_client_id}?project=${your_project_number}

你能指出正确的方向来解决这个问题吗?

最佳答案

Error 400: redirect_uri_mismatch

是配置问题。重定向 uri 用于在用户同意您的应用程序访问您的数据后将授权代码返回给您的应用程序。您已在 Google 开发者控制台上创建了网络客户端凭据。

你需要做的是回到那里并添加一个 Redirect uri

 http://localhost:3000/api/auth/callback/google

它必须完全匹配,不要在末尾添加任何空格或任何东西。

如果您有任何问题,我有一个视频会向您展示如何添加它 Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.

关于oauth - 从 Google 获取登录和重定向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67096519/

相关文章:

node.js - 如何解决Google Drive API中的 "failed to parse Content-Range Header"以执行可恢复上传

google-play - 坚持拒绝和更新循环谷歌播放控制台

oauth - OAuth 中的 "offline"访问是什么意思?

c# - ASP.NET OAuth : How is access token generated?

javascript - gapi.auth.authorize with immediate : true is not working

android - Android 上 Google Fit 的 OAuth 2.0 客户端 ID 的用途是什么

ios - iOS Google Drive SDK-文件夹的查询字符串似乎不起作用

java - 在 Principle 上存储多个值

facebook - fb :login-button if oauth 2. 的注册 url 参数失败 0 已启用

android - 如何从 Google Play 开发者控制台删除或隐藏暂停的应用程序?