Oleg
Oleg

Reputation: 766

JavaScript API call for "/me/friends" returns a response with empty list but correct summary

I do the call:

FB.api('/me/friends', function(response) { console.log(response);});

I see in the console log response as and object with empty data and correct summary:

 Object { data=[0], summary={...}}

Where summary is (the number of my friends):

Object { total_count=444}

I know that friends edge call has been changed through APi v2.1. It works in Graph API explorer. I hve specified permissions for the requested operation before:

<fb:login-button scope="user_friends" onlogin="checkLoginState();">
</fb:login-button>

What am I doing wrong?

Upvotes: 0

Views: 1002

Answers (1)

Phillip
Phillip

Reputation: 1570

You misunderstand what the user_friends permission is for. This is taken from the docs about the user_friends permission:

user_friends

Provides access the list of friends that also use your app. These friends can be found on the friends edge on the user object.

In order for a person to show up in one person's friend list, both people must have decided to share their list of friends with your app and not disabled that permission during login. Also both friends must have been asked for user_friends during the login process.

Review

Your app may use this permission without review from Facebook.

Common Usage

Use the list of friends to create a social experience in your app.

Upvotes: 2

Related Questions