[英]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.