oauth-2.0 - 为什么 OAuth2 不允许在重定向 URI 中包含片段标识符?

标签 oauth-2.0 openid-connect

根据OAuth2.0 spec ,重定向 URI 不应包含片段标识符。

The redirection endpoint URI MUST be an absolute URI as defined by [RFC3986] Section 4.3. The endpoint URI MAY include an "application/x-www-form-urlencoded" formatted (per Appendix B) query component ([RFC3986] Section 3.4), which MUST be retained when adding additional query parameters. The endpoint URI MUST NOT include a fragment component.

规范做出此类限制是否有任何具体原因?

提前致谢!

最佳答案

URL 片段永远不会离开您的浏览器。它们旨在供前端使用(这意味着如果您将哈希片段放入浏览器中的 URL 并访问它,片段将不会到达服务器端)。

因此,当授权服务器通过用户代理重定向时,片段将仅保留在用户代理上。从 OAuth 的角度来看,这可能会带来不必要的复杂性和安全漏洞。这在Insufficient Redirect URI Validation下进一步突出显示。在最佳实践草案中。

关于oauth-2.0 - 为什么 OAuth2 不允许在重定向 URI 中包含片段标识符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60257717/

相关文章:

java - 通过服务帐户 key 访问 Google Sheets API

android - Chrome 自定义标签,与 Oauth2 深度链接

azure - 即使 URI 匹配,我仍收到 Azure 应用程序的 URI 重定向错误

c# - 一小时后身份从不记名 token 中消失

java - 从 OpenID 2.0 迁移到 OpenID Connect : cannot use the openid_id to select appengine users

spring-security - 如何限制用户仅使用选定的客户端登录?

oauth-2.0 - 在没有前端的情况下访问 LinkedIn REST API(例如 OAuth2 重定向)

asp.net - 在同一个 WebForms 应用程序中组合 Forms auth 和 OpenIdConnect auth

java - 使用带有 OpenID Connect 提供程序的 spring-security-oauth2 客户端时如何访问 "id_token"和 "refresh_token"?

c# - OpenIdConnectProtocolValidator - 随机数错误