Showing posts with label Facebook Graph API. Show all posts
Showing posts with label Facebook Graph API. Show all posts

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!

Facebook Access Tokens in a nutshell

Three different types of access tokens


APP access tokens

are used to get information that your app is privileged to access from the Facebook Graph API. And in some cases where publish_stream is granted from an app user, you can use it to post to that user's wall, without needing a USER access token.

USER access tokens

are given to your app and they relate to the permissions a specific app user has granted to your application so you app can act on their behalf when interacting with the Facebook Graph API.

PAGE access tokens

are given to page admins so they can act on behalf of the page. To go from a user access token to a page access token, call /me/accounts using the user access token to get a list of pages they admin along with each pages access tokens.

Useful tips


If you have an access token and you want to know more information about it, lint it at Facebook's URL and access token debugger.

For more information on access tokens see: Facebook's authentication documentation.