0

I am trying to get user's friend list from facebook Graph-api. So after getting access token when I try to open by urlopen by

https://graph.facebook.com/facebook_id/friends?access_token=authentic_accesstoken

this doesn't give friend_list of person(facebook_id) not even when I open it directly on the browser, at least not the entire list. This is what it shows on the browser

{
   "data": [
      {
         "name": "Face_id_name",
         "id": "facebook_numeric_id"
      }
   ],
   "paging": {
      "next": "https://graph.facebook.com/v2.2/facebook_id/friends?access_token=authentic_accesstoken&limit=25&offset=25&__after_id=enc_Some_encrypted_code"
   },
   "summary": {
      "total_count": 263
   }
}

In data it doesn't show the entire list and when I use link to paging: next: it doesn't give me anything just total count again.
I am not entirely sure whether my url is right or not.

aniket
  • 95
  • 5
  • 12

1 Answers1

1

You can´t get the friends of ANY user, you can only get the friends of the authorized user and only those who authorized the App too - for privacy reasons. So this is the only correct call:

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

There is no need to use the ID, because you can only use the ID of the authorized user anyway. So you can just use "me" instead.

More information about the limited friend result can be found in countless other threads, for example: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app

Community
  • 1
  • 1
andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • there will not be any problem in getting entire list of likes? – aniket Feb 03 '15 at 17:26
  • please don´t delete your comments. i had to delete mine too because it does not make sense anymore. – andyrandy Feb 03 '15 at 17:27
  • I have one more question related to facebook-login. Is there a way by which I can tell (just from facebook-app) who logged into my site? – aniket Feb 07 '15 at 13:37
  • well, if someone is on your website, you can figure it out easily. you just need to store logins with times in a database and show everyone in a timeframe as online. – andyrandy Feb 07 '15 at 14:14
  • I did that and I can tell who is logged in. but I just wanted to know is their a way in fb-app. then what is the use of making a new app just for login. – aniket Feb 07 '15 at 14:45
  • there is no way with the api. the point of making a facebook login is that you dont need to create your own login routing, for example. – andyrandy Feb 07 '15 at 15:14