如何跨域和 Safari 检索 Facebook cookie
我一整天都在研究这个问题,所以我真的需要你的帮助。
我正在尝试使用 Facebook Connect 创建多站点登录系统,但不幸的是我无法检索 Cookie。
这里有更多细节:
我有一个网站 (www.first.com),其中有一个指向 www.second.com 的 iFrame,其中显示 Facebook Connect 按钮。我必须使用此方法,因为 Facebook 应用程序仅对 1 个网站有效,而我需要在多个网站上使用它。 当用户单击按钮并登录 Facebook 时,他会重定向到 www.second.com,该数据库将值保存在数据库中,稍后在 www.first.com 上检索该数据库,
在 Firefox、IE 8/7 中一切正常自从我添加了 P3P 标头以来,效果也很好。
问题是我无法让它在 Safari 上工作,这需要该用户与 iframe 进行某种交互。 我找到了一个代码( http://anantgarg.com/2010 /02/18/cross-domain-cookies-in-safari/ )但我不知道如何使用它,我已经尝试了所有可能的方法(我认为),但什么也没有。我想它不起作用,因为我需要在 Facebook 的服务器上使用它(我显然可以;))
有人有想法吗?
抱歉,文字太多;)如果您需要更多信息,请告诉我。
I've been working on this problem all day long, so I really need your help.
I'm trying to create a multi-site login system with Facebook Connect and unfortunatly I can't retrieve Cookies.
Here's a little more details:
I'm having a website (www.first.com) which has an iFrame to www.second.com, which display the Facebook Connect button. I have to use this method because a Facebook App is only valid for 1 website, and I will need to use it on multiple.
When the user clicks on the button and log into Facebook, he is redirect to www.second.com, which saves values in a database, which is later retrieved on www.first.com
Everything is working fine in Firefox, IE 8/7 works fine too since I've added the P3P header.
The problem is that I can't make it work on Safari, which requires some kind of interaction from this user to the iframe.
I found a code ( http://anantgarg.com/2010/02/18/cross-domain-cookies-in-safari/ ) but I'm not sure how to use it, I've tried every possible way (I think), and nothing. I guess it doesn't work because I would need to use this on Facebook's server (which i can obviously ;) )
Does anyone have an idea?
Sorry for the huge block of text ;) let me know if you need more information.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
跨域 Cookie 听起来像是一个安全漏洞。
你确定没有触犯同源政策?
事实上,据我所知,您无法从 secondary.com 访问 first.com 的 cookie
Cross Domain Cookies sounds like a security-bug.
Are you sure you don't offend against the same origin policy?
In fact afaik, you can't access a cookies for first.com from second.com