Facebook (FB.login) not requesting my permissions

Johny picture Johny · Aug 9, 2011 · Viewed 14.9k times · Source

so after updating to the php 3.0 sdk and what not, my FB.login() function no longer asks for the permissions I set it to ask. Any one else getting this? Here's some code for you:

window.fbAsyncInit = function() {
  FB.init({
    appId: 'xxx',
    status: true,
    cookie: true,
    xfbml: true,
    oauth : true // enables OAuth 2.0
  });
  // whenever the user logs in, we refresh the page
  //FB.Event.subscribe('auth.login', function() {
  //  window.location.reload();
  //});      
};


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:'read_stream,publish_stream,offline_access'});

The way I'm trying to access it, is through an onClick="FB.login();". Can anyone help?

Answer

Tibor picture Tibor · Aug 16, 2011

Checking the source of the JS SDK I found that they still use perms and not scope as it it documented. This is working for me:

...onclick="FB.login(handleLoginResponse, {perms:'email,manage_pages,user_birthday'});return false;"...

I hope it helps.