简体   繁体   English

Facebook Graph API-获取您的朋友列表的朋友?

[英]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. 我正在使用ruby on rails gem考拉访问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. 其中fb_uid是朋友uid,但这不起作用。 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 .... 如果用户使用omniauth登录,则将获得令牌,并且可以使用该令牌调用https ://graph.facebook.com/me/friends?access_token=AAAD46kEqljsBAKQEbJ2mU6seZCLunsCbT0zmGNc...。

and get the friendlist in JSON format 并以JSON格式获取好友列表

{
   "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. 从业务的角度来看,这也是有道理的...如果您可以向Facebook询问每个人的朋友,那么社交图谱就不再是Facebook的了。 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. 另外:您的朋友没有对您的信息(某些随机应用程序)给予许可,因此,这是未经他们同意而无法获取的另一个原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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