【问题标题】:Google Authorized redirect URIs formatGoogle 授权的重定向 URI 格式
【发布时间】:2018-10-26 02:05:53
【问题描述】:

我正在尝试将 Google 身份验证与我的 ASP.Net 核心应用程序集成。在登录 google 重定向回应用程序主页后,我已成功地将应用程序与 Google 身份验证集成。但是,我希望它重定向到https://localhost:44303/Home/dashboard。

为了解决这个问题,我已将“授权重定向 URI”从 https://localhost:44303/signin-google 更改为 https://localhost:44303/Home/dashboard,但是当我这样做时,我收到了 redirect_uri_mismatch 错误。我需要遵循特定的“授权重定向 URI”格式吗?我检查了https://developers.google.com/identity/protocols/OAuth2WebServer 的文档,但也许我遗漏了一些非常明显的东西。

OAuth 同意屏幕:我无法在“授权域”文本框中添加 localhost。

OAuth 客户端限制:如果我在授权的重定向 URL 中添加 https://localhost:44303/Home/dashboard,则会收到 redirect_uri_mismatch 错误。

堆栈跟踪: 错误:redirect_uri_mismatch

The redirect URI in the request, https://localhost:44303/signin-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/685730099587-d2rac5lt7981tjkoo5td23ogm2q1at20.apps.googleusercontent.com?project=685730099587

Learn more

Request Details
response_type=code
client_id=685730099587-d2rac5lt7981tjkoo5td23ogm2q1at20.apps.googleusercontent.com
redirect_uri=https://localhost:44303/signin-google
scope=openid profile email
state=CfDJ8HG_FpcxsWVNk9Pwwx_Fh6NNjkmrebqlP7rA3Y3u0fx42o-r6KMmiNmbmC2vjIuZLqmTZMA8O8AfMgIxXO8Tj9k3x2PLe6wNyL7xqOXi6Yj-AJUmeZFwievUqEAuCKHClYJOFPAlKTxrnYIYCXoJjvwg8BM4JBKA_NgFGjy_CbGHrI2kyUC63Z7INhYHdwEyO13AsBfYXR4LfxAGf3jz3x8-ZKDUDgFOqYYKXXcDHt2VqlERXOVXdEqNUcxUtfhM

【问题讨论】:

    标签: asp.net-core google-plus google-oauth google-plus-signin


    【解决方案1】:

    消息

    请求中的重定向 URI, https://localhost:44303/signin-google,不匹配 授权给 OAuth 客户端。更新授权重定向 URI,请访问: https://console.developers.google.com/apis/credentials/oauthclient/685730099587-d2rac5lt7981tjkoo5td23ogm2q1at20.apps.googleusercontent.com?project=685730099587

    告诉你几乎所有你需要知道的。请注意,您可以配置多个重定向 URL 来处理测试、阶段和生产服务器的每个排列。只需确保您的应用使用的重定向 URL 与配置的 URL 之一完全匹配即可。

    【讨论】:

    • 我在上面为我的问题添加了更多详细信息(包括屏幕截图)。
    【解决方案2】:

    遇到同样的问题! 只需添加到授权重定向 URL:

    https://localhost
    

    没有任何端口或额外的东西!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-28
      • 2020-02-29
      • 2015-08-09
      • 1970-01-01
      • 2019-01-07
      • 1970-01-01
      • 2023-01-01
      相关资源
      最近更新 更多