Updates to Facebook Javascript SDK for OAuth 2.0

If you’ve recently realized that maybe your current Facebook application is no longer working I have a few areas of your code to check. Like me if you failed to realize that December 13th, 2011 was the deadline for Facebook supporting OAuth 1.0 in it’s Javascript SDK then the following are likely the root causes:

  1. “perms” is now to be referred to as “scope” when asking for permissions from a user
  2. “session” is now to be referred to as “authResponse”
  3. “access_token” is now to referred to as “accessToken”

And the examples:

The Old:

FB.login(function(response) {
  if (response.session) {
    console.log("User is connected to the application.”);
    var accessToken = response.session.access_token;
  }
});

And the New:

FB.login(function(response) {
  if (response.authResponse) {
    console.log("User is connected to the application.”);
    var accessToken = response.authResponse.accessToken;
  }
});

Leave a Reply

Your email address will not be published.