简体   繁体   English

使用Graph API获得朋友的喜欢和信息

[英]Getting Friends Likes and Information using Graph API

I am having trouble getting a user's friends' likes. 我无法获得用户朋友的喜欢。 I can get gender, name and birthday, but not television, movies, music,books, games and likes. 我可以获取性别,姓名和生日,但不能获取电视,电影,音乐,书籍,游戏和喜欢的对象。

Note, the user selects a friend, and then the website displays their likes. 注意,用户选择一个朋友,然后网站显示他们的喜欢。

me/friends?fields=gender,name,birthday,television,movies,music,books,games,likes&uid={USERID}

It works when I am logged onto my account, but not when one of my friends accounts. 当我登录到我的帐户时,它起作用,但是当我的一个朋友帐户时,它不起作用。

Why is that? 这是为什么? I have checked that I have the correct permissions. 我检查了我是否具有正确的权限。

It maybe possible im not using the using the access token correctly, or possible the the graph api requires https to function. 可能是即时通讯未正确使用访问令牌,或者图形api需要使用https才能起作用。

See a live version: http://nu-voo.co.uk/fb/examples/with_js_sdk.php 查看实时版本: http : //nu-voo.co.uk/fb/examples/with_js_sdk.php

You don't have the correct permissions. 您没有正确的权限。 The permission needed for friend likes is friends_likes you need to add this to your scope array in your PHP login URL. 朋友喜欢的权限需要是friends_likes,您需要将此权限添加到PHP登录URL中的作用域数组中。

Example

$params = array(
  'scope' => 'friends_likes',
  'redirect_uri' => 'http://nu-voo.co.uk/fb/examples/with_js_sdk.phpe'
);

$loginUrl = $facebook->getLoginUrl($params);

or using the Facebook login button 或使用Facebook登录按钮

<fb:login-button scope="friends_likes"></fb:login-button>

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

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