empty friends array in facebook open graph api v2

不羁的心 提交于 2020-01-06 20:35:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!