Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty Facebook friends list

So I'm using the "Facebook-sdk" plugin. I'm initializing Facebook like this:

FB.init({ appId: 'xxxxxxxxxxx', cookie: true, xfbml: true, oauth: true, status: true });

    FB.login(function(){ // get permissions
    }, {scope: 'user_friends, read_friendlists, user_photos, email, publish_actions  '});

    FB.getLoginStatus(function (response) { // to generate AccessToken
      if (response.authResponse) {
        console.log('LoginStatusResponse: ' + JSON.stringify(response, null, 4));
      } else {
        console.log('AuthResponse: No');
      }
    });

Then in response to a button click event, I'm doing:

'click #get_fb_friends' : function(event, template) {

    FB.api( 
      "/me/friends",
      function (response) {
        if (response && !response.error) {
          console.log('GOT them !!!' + JSON.stringify(response, null, 4));
          return response;
        } else {
          console.log('No can do' + JSON.stringify(response, null, 4));
        }
      });
  }

The thing is that I'm getting an empty Data variable:

GOT them !!!{
    "data": []
} 

PS: The query "/me" returns all information about myself, it's the "/me/friends" that doesn't work.

Can it be a permissions problem ?

like image 686
Alucard Avatar asked Mar 08 '26 21:03

Alucard


1 Answers

Facebook has changed its api a few weeks ago,you can only access a list of your friends when they have personally accepted to use your app.. Nothing to do about it

like image 80
Wampie Driessen Avatar answered Mar 10 '26 16:03

Wampie Driessen