简体   繁体   中英

Create a cookie accessible to a domain A from a popup in a domain B

The functionality im trying to create is similar to how facebook connect works, in a domain A when a button is pressed a popup fires up, showing content from a domain B, on this popup if the user login a cookie is created and then the popup is closed, but since this cookie was created in the domain B i cant access that information from A. How facebook solve this? Im a javascript and PHP developer so if you provide me with a code example it will be very appreciated.

Cookies created in one domain can't be accessed from another domain. It can be managed with subdomains, but not with different domains. You will need to find a different solution to your issue.

I don't know what Facebook solution you are referring to, but as best I know, Facebook uses iframes on their own domain and thus they can access their own cookies from their iframe.

You can look at the oauth spec for one standard way that authorization is done between domains.

And, here's a reference on how Facebook Connect works: http://thinkdiff.net/facebook/new-javascript-sdk-oauth-2-0-based-fbconnect-tutorial/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM