简体   繁体   English

OAuth重定向片段丢失后

[英]after OAuth redirect fragment gets lost

I have a web environment where I'm accessing my resources using fragments. 我有一个Web环境,使用片段访问资源。 (like foo.com/#/my_resource). (如foo.com/#/my_resource)。

I'm trying to add authentication using OAuth 2 to my server. 我正在尝试使用OAuth 2向服务器添加身份验证。 And I'm using Shiro framework with pac4j. 我在pac4j中使用Shiro框架。 The problem I have here is, after I log in to the provider, the browser loses my hash so I get redirected to foo.com/ instead of foo.com/#/my_resource. 我遇到的问题是,登录到提供程序后,浏览器丢失了我的哈希,因此我被重定向到foo.com/而不是foo.com/#/my_resource。

Thought it might be a common problem. 认为这可能是一个普遍的问题。 Are there any workarounds for this? 有什么解决方法吗? Is this behavior expected? 这是预期的行为吗?

Thanks! 谢谢!

If you submit a request to a URL with a fragment, the fragment is not sent to the server - it is a client-side only concept. 如果您向带有片段的URL提交请求,则片段不会发送到服务器-这是仅客户端的概念。 So the server would be unable to redirect to a URL and include the original fragment. 因此,服务器将无法重定向到URL并包含原始片段。

Also, it's not quite clear from your question, but if what you mean is that you are using this as the redirect_uri parameter in an OAuth 2 request, the spec explicitly forbids the use of a fragment in the value . 另外,您的问题还不清楚,但是如果您的意思是要在OAuth 2请求中将其用作redirect_uri参数,则该规范明确禁止在value中使用片段

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OAuth2 一次性授予注册和丢失密码 - OAuth2 one-time grant for signup and lost password 子域的动态Oauth2重定向URL - Dynamic Oauth2 Redirect URL for subdomains Oauth 什么重定向 uri 为 wordpress 插件 - Oauth what redirect uri for wordpress plugin 如何从重定向窗口检索oAuth Accees令牌 - How to retrieve oAuth Accees token from Redirect Window 将 OAuth 添加到 azure API 管理 - 重定向 URI 为 Z37A6259CC0C1DAE299A786648 - Adding OAuth to azure API management - Redirect URI is null 如何将 OAuth 重定向事件传递给 Chrome 扩展程序? - How do you pass OAuth redirect events to Chrome Extensions? 是否为Google API和Oauth 2.0(无论是否适用于www)正确设置重定向URI? - Correct redirect URI for Google API and oauth 2.0 for both www and without? Uber API OAuth2错误:未提供带代码的重定向URI - Uber api oauth2 error: No redirect URI with code is provided Salesforce Oauth重定向CORS问题节点快速应用程序 - Salesforce Oauth redirect CORS issue node express app VersionOne:query.v1 C#OAuth2收到401未经授权的错误,但rest-1.oauth.v1 / Data /正常工作 - VersionOne: query.v1 C# OAuth2 gets 401 Unauthorized error but rest-1.oauth.v1/Data/ does work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM