Tuesday, April 17, 2012

Facebook login, I don't get session when in IE

The symptoms


I've implemented Facebook login on my website using one of the Facebook Graph API SDKs, all browsers seem to work other than Internet Explorer (IE). In IE, the session doesn't seem to work. Why is that?

The problem


Internet Explorer is very twitchy about storing cookies from 3rd parties. This is what is happening with your site and how Facebook logs in. Since the user is on your domain, IE is simply ignoring your session cookie.

The solution


Simply implement P3P headers in your server's responses. This way IE will think your site is alright and then allow this 3rd party cookie to be stored allowing session to be maintained for the SDK to use.

Here's a couple of articles on how to implement a P3P header.

Happy Coding!

No comments:

Post a Comment