hanesh
hanesh

Reputation: 480

check if user likes a page with Laravel Socialite

I'm using Laravel Socialite to make users log in to my site. I've managed to do that and store the user's data.

But now i want to find out how i can check if that particular user (when logged in) has liked my facebook page.

Thank you so much!

Upvotes: 1

Views: 1067

Answers (1)

codenut
codenut

Reputation: 221

Socialite is a package that handles authentication using Facebook, Twitter, LinkedIn, Google, GitHub and Bitbucket. It does not have the ability to retrieve information regarding user likes.

You can use the facebook-php-sdk inorder to get the pages that user has liked. The code below is from the facebook graph api documentation on how to get the pages that the user has liked.

/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{user-id}/likes'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */

Upvotes: 1

Related Questions