简体   繁体   中英

Facebook Graph API - Getting a list of your friends friends?

I'm using the ruby on rails gem koala to access the facebook graph API.

What I want to be able to do if make a call to get a list of my friends friends.

I'm trying that with:

fb_connections = @graph.get_connections(fb_uid, 'friends').to_json

where fb_uid is a friends uid, but that is not working. It's only sending back friends for my account not my friends. Why is that?

Thanks

If user is logged in with omniauth, you get the token, and you can use that token to call https://graph.facebook.com/me/friends?access_token=AAAD46kEqljsBAKQEbJ2mU6seZCLunsCbT0zmGNc ....

and get the friendlist in JSON format

{
   "data": [
      {
         "name": "Andrew Rude",
         "id": "500111111"
      },
...

You can't.

From a technology standpoint, you can only request information about yourself, so YOUR education and YOUR friends.

It also makes sense from a business standpoint... If you could just ask facebook for everybody's friends, then the social graph would cease being facebook's. it'd be yours.

Also: your friend hasn't given your (some random app) clearance to their information, so that's another reason you can't get it without their consent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM