Likes API

This article will describe what can you do with the plugin likes API. You can read more about Likes API on facebook developers portal.


  • A user access token with user_likes permission is required to see all pages liked by that person.

Basically Likes API allows us to find out pages linked by the user, or check if the user has liked a specific page.


To get the list of a current user likes you can use:

if(_likes.ContainsKey(userId)) {
			foreach(KeyValuePair<string,  FB_LikeInfo>  pair in _likes[userId]) {


Each like is represented  as FBLikeInfo class instance and contains following info:

public string id;
public string name;
public string category;


You can also find out if the user has liked specific page, for example, to find out if the current user liked Union Assets Facebook Page we can use following code:

bool IsLikes = SPFacebook.instance.IsUserLikesPage(SPFacebook.instance.UserId, UNION_ASSETS_PAGE_ID);


Of course, before we can get this info we need to load user likes info, we ca do this in few ways.

Load likes list for current user: 



Load likes for the specific user:



Load likes for specificity user and page:

SPFacebook.instance.LoadLikes(SPFacebook.instance.UserId, UNION_ASSETS_PAGE_ID);


As soon as the request will be ready, the 

public static event Action<FB_Result> OnLikesListLoadedAction = delegate {}

Action will be fired, and we will be able to use the function described in first article section.

The following code snippet shows how to retrieve user likes

SPFacebook.OnLikesListLoadedAction += OnLikesLoaded;

private void OnLikesLoaded(FB_APIResult result) {
	//The likes is loaded so now we can find out for sure if user is like our page
		bool IsLikes = SPFacebook.Instance.IsUserLikesPage(SPFacebook.instance.UserId, UNION_ASSETS_PAGE_ID);
		if(IsLikes) {
			SA_StatusBar.text ="Current user Likes union assets";
		} else {
			SA_StatusBar.text ="Current user does not like union assets";


More examples can be found under the Facebook Example scene.