Rob513
Rob513

Reputation: 57

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

Upvotes: 0

Views: 636

Answers (1)

phwd
phwd

Reputation: 19995

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>

Upvotes: 1

Related Questions