简体   繁体   中英

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.

See a live version: 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.

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

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

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