Erdem Çetin
Erdem Çetin

Reputation: 495

How to get user or page likes with Facebook SDK v5?

Hi my facebook app version is 2.7.I want to get user likes or page likes with Facebook SDK v5. I've get likes with user access token. But user access token expire after 1 day later. My php get request :

$request = new FacebookRequest
(
  $session,
  'GET',
  '/me/',
  array(
    'fields' => 'email,name,gender,birthday,likes'
  )
);

I get user's email,name,gender,birthdate but I can't get user likes. How can I get user likes or page likes ?

Upvotes: 0

Views: 383

Answers (1)

andyrandy
andyrandy

Reputation: 74014

You need to authorize with the user_likes permission to get the likes. Keep in mind that you can only get the Pages a user likes, there is no way to get other likes (post likes, website likes, ...).

Make sure the Token includes the permission: https://developers.facebook.com/tools/debug/accesstoken/

Btw, you can extend a User Token to be valid for 60 days:

Upvotes: 1

Related Questions