Search code examples
facebook-graph-apifacebook-javascript-sdkfacebook-friends

friends list among specific application users returns empty


this is similar to questions that appear in many threads, but there is an important difference, so it's a separate problem as far as i can tell. I am trying to fetch friends that are also users who have logged in to the same application, (the other threads refer to trying to fetch friends regardless of being app users) using the javascript sdk (FB api 2.1), I have logged in the application with FB users who are friends, and expected to find them in the results, but still the list comes back empty. this is the only interaction I need with FB for my application, maybe there's another way to do it? Thank you for you help.

FB.api(
    "/me/friends",
        function (response) {
            if (response && !response.
             //monitor response
            }
        }
    );

EDIT: I've found out the problem- I had misunderstood the flow: the by default approved friend-list permission means than the application is allowed to ask for permission, i had mistakenly assumed that it means that the permission is not even needed. once added to the scope list it worked fine.


Solution

  • There are usually only two reasons why the response is empty:

    • No friend is using the App (not your case, i guess)
    • You did not ask for the user_friends permission in the login process (scope parameter)

    About the second part, keep in mind that the permission is "approved" by default, but you still have to ask for it (at least since v2.0 of the Facebook API). It was included in v1.0, but it´s a separate permission now.