how to get a list of all user friends?

点点圈 提交于 2020-01-24 08:14:03

问题


I am building an app using Facebook Graph API v.20.

The first thing it needs to do is to export the complete list of friends from the user (ID, name and picture) to a CSV file.

Is this possible?


回答1:


Short answer: No.

The Graph API v2.0 reference documentation implies that your app will only be able to access (through the API, at least) those of the user's friends who have themselves used your app and allowed your app to access their own friends list:

Permissions

  • A user access token with user_friends permission is required to view the current person's friends.

  • This will only return any friends who have used (via Facebook Login) the app making the request.

  • If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person.

@user664833 pointed out some clarifications to the policy in the comment below:

Effective April 30th, 2014 for Facebook's API v2.0: (1) Friend list is no longer part of the default permission set and has its own permission: Asking for access to a person's friend list is now a separate permission that your app must request. The new permission is called user_friends. (2) Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app. developers.facebook.com/docs/apps/changelog -- URL accessible by FB users registered as developers – user664833 Jun 10 at 5:50

Actually, the URL seems to be public, since I can view it while not logged in. The changelog also explains why some apps can still view all friends, as @SimonCross pointed out:

For apps that existed before April 30th 2014, making an API call without specifying a version number ('unversioned') is equivalent to making a call to the v1.0 of the API.

For apps created on or after April 30th 2014, making an API call without a specifing a version number is equivalent to making a call to v2.0 of the API.

Apps that were inactive or have a creation date on or after April 30th, 2014 will not be able to make calls to v1.0 of the API. They must use v2.0.



来源:https://stackoverflow.com/questions/23788666/how-to-get-a-list-of-all-user-friends

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