简体   繁体   English

如何使用Facebook SDK v5获得用户或页面赞?

[英]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. 嗨,我的Facebook应用程序版本为2.7。我想通过Facebook SDK v5获得用户喜欢或页面喜欢。 I've get likes with user access token. 我喜欢用户访问令牌。 But user access token expire after 1 day later. 但是用户访问令牌将在1天后过期。 My php get request : 我的PHP获取请求:

$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 ? 如何获得用户喜欢或页面喜欢?

You need to authorize with the user_likes permission to get the likes. 您需要使用user_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/ 确保令牌包含许可: https : //developers.facebook.com/tools/debug/accesstoken/

Btw, you can extend a User Token to be valid for 60 days: 顺便说一句,您可以将用户令牌的有效期延长60天:

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

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