Custom Search
Logiclabz

Facebook Login Error - Oauth2 specification states that 'perms' should now be called 'scope'

  

As of December 13th, 2011, the JavaScript SDK now only supports OAuth 2.0 for authentication. The ability to enable OAuth 2.0 in the JS SDK was first introduced in July. All apps were given until October 1, 2011 to test and migrate. With this change, please ensure that you replaced response.session with response.authResponse. To ask for permissions, you must use scope instead of perms. Read more about the specific changes here.

https://developers.facebook.com/blog/post/525/

Change required:

1) response.session should be changed to response.authResponse

Old:

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

New:

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

2)auth.sessionChange is deprecated and being replaced with auth.authResponseChange

3)perms should be changed to scope

New:

FB.login(function(response) {
  if (response.authResponse) {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Good to see you, ' + response.name + '.');
      FB.logout(function(response) {
        console.log('Logged out.');
      });
    });
  } else {
    console.log('User cancelled login or did not fully authorize.');
  }
}, {scope: 'email'});



  


Leave a reply




Do you like this post?