asp.net-core - Google 授权的重定向 URI 格式
问题描述
我正在尝试将 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 客户端限制:如果我添加https://localhost:44303/Home/dashboard
了授权的重定向 url,那么我会收到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
解决方案
只是遇到同样的问题!只需添加到授权重定向 URL:
https://localhost
没有任何端口或其他东西!
推荐阅读
- python - 通过 Python 查找网页何时更新?
- reactjs - 使用 Redux 工具包保存 FormData 时出现类型错误
- swagger - 当我们在 OpenAPI POST 端点的请求正文(JSON)中传递额外字段时会发生什么
- c - “错误:在创建共享对象时无法使用针对 `.text' 的重定位 R_X86_64_32S”,同时创建动态库
- java - LinkedList Implementation Java - get(int index) - Explain what this code does
- python - 如何审查 Django 博客评论中的单词?
- asp.net - AspNet Visual Studio - 合并程序集时出错
- c++ - 如何为 Boost.Locale 中的数字指定自定义小数分隔符?
- azure-ad-b2c - 可以在忘记密码的链接上禁用 &hint= 吗?
- python - 从其他列的值中过滤列值并将结果转换为多个列表 Pandas