问题
I'm trying to pull a list of my friends in Facebook's OG api v2. If I use the explorer here:
https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends&version=v2.0
I can get my friends, but if I program the app and make a json call:
function getUserFriends(){
FB.api('/me/friends', function(response) {
console.log(response);
});
}
The friends array response is an empty object.
I'm using the facebook login button:
<fb:login-button scope="public_profile,email,user_about_me,user_birthday,user_education_history,user_hometown,user_location,user_relationships,user_relationship_details,user_photos,user_friends,read_friendlists" onlogin="checkLoginState();">
</fb:login-button>
and I can access a lot of other data about myself, but not friends. Any idea what I'm missing?
回答1:
Facebook changed a lot of things recently, for privacy reasons you can only get the friends who are also using the App now. See here:
- https://developers.facebook.com/docs/apps/changelog
- https://developers.facebook.com/docs/apps/upgrading/
Also see here: Friendslist doesn't work anymore after the powerful access_token
来源:https://stackoverflow.com/questions/23963735/empty-friends-array-in-facebook-open-graph-api-v2