How to use the Graph API to show the user my facebook friends who have already registered for my site

I look at the Graph API .. and how to get friends of friends, apparently this only returns the friend’s name and id, I don’t know how to do this, I need something like email, show them that these friends are already registered for my site ....

Sorta is similar to what foursquare does

+3
source share
3 answers

It depends on how you track friends in your application, if you just save your facebook id along with other information in your application, then getting a friends list without any parameters is enough, as it returns the id and default name:

https://graph.facebook.com/me/friends?access_token=AUTH_TOKEN

returns:

{
   "data": [
      {
         "name": "Friend1",
         "id": "123456"
      }
   ]
}

If you do not track any information on facebook in your application and want to compare based on some other field, you should add the fields parameter and specify the field you want to find:

https://graph.facebook.com/me/friends?access_token=AUTH_TOKEN&fields=name,picture

returns:

{
       "data": [
          {
             "name": "Friend1",
             "id": "123456",
             "picture": "http://profile.ak.fbcdn.net/hprofile-ak/blalala"                 
          }
    ]
}
  • id is always returned, even if you do not specify it in the field parameters.
  • E-mail requires extended permissions, which will be granted after the user adds your application and is not an option from the list of friends ...

/ : http://developers.facebook.com/docs/reference/api/user

+3

, , , , , api url json.

https://graph.facebook.com/me/friends?access_token=AUTH_TOKEN

.

0
source

Source: https://habr.com/ru/post/1774080/


All Articles