gpt4 book ai didi

facebook - 奇怪的 url 附加 "#_=_"

转载 作者:行者123 更新时间:2023-11-30 05:14:05 27 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Play Framework appending #= to redirect after Facebook auth via OAuth2?

有没有其他人看到过这种情况?

我正在使用 Facebook PHP SDK 和一些 Javascript 构建一个 Facebook Canvas 应用程序。
现在,当我让用户通过 OAuth 身份验证流程时,我注意到浏览器中的 URL 会自动附加此 "#_=_" ,所以我的 URL 开始看起来像这样:

http://apps.facebook.com/xxxxxxxxxxxx/#_=_

当我重定向到应用配置文件页面时,URL 是这样的:

http://www.facebook.com/apps/application.php?id=xxxxxxxxxxxx#_=_

我正在使用重定向

echo "<script type='text/javascript'>top.location.href='$appcanvasurl';</script>"

Canvas URL,以及

echo "<script type='text/javascript'>top.location.href='$appprofurl';</script>"

用于应用配置文件页面。

那么为什么这个 #_=_ 会被追加?

更新:

根据 this bug on the tracker ,这是设计使然,为 redirect_uri 赋值不会改变这一点。

并根据official facebook reply on that page (必须登录到 Facebook 才能查看帖子):

This has been marked as 'by design' because it prevents a potential security vulnerability.

Some browsers will append the hash fragment from a URL to the end of a new URL to which they have been redirected (if that new URL does not itself have a hash fragment).

For example if example1.com returns a redirect to example2.com, then a browser going to example1.com#abc will go to example2.com#abc, and the hash fragment content from example1.com would be accessible to a script on example2.com.

Since it is possible to have one auth flow redirect to another, it would be possible to have sensitive auth data from one app accessible to another.

This is mitigated by appending a new hash fragment to the redirect URL to prevent this browser behavior.

If the aesthetics, or client-side behavior, of the resulting URL are of concern, it would be possible to use window.location.hash (or even a server-side redirect of your own) to remove the offending characters.

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com