Reputation: 51
I used Facebook Page Plugin to display page like widget (https://developers.facebook.com/docs/plugins/page-plugin) on my site. When I run my site FB page widget is open with like and share buttons. When user clicks on like it opens a popup and prompt user to enter FB login once user enters it and authenticated the widget is refreshed and now like button is greyed out. How do I know the user details who liked the page? I want to save these details so that I can check if user has already liked the page or not if yes they can use the site directly if not then they must first like the page and then use the site. My application is built on C# ASP.Net MVC. I also want the request to Facebook should go from it from C# code. Let me know the correct process in case I'm not following correct procedure.
FB page like widget code is
<div class="fb-page" data-href="https://facebook.com/codeblends" data-width="380" data-hide-cover="false" data-show-facepile="false" data-hide-cta="true"
data-show-posts="false"></div>
In JS
window.fbAsyncInit = function () {
FB.init({
appId: '@ReadConfig.FacebookAppID',
cookie: true,
xfbml: true,
version: '@ReadConfig.FacebookAPIVersion'
});
FB.Event.subscribe('edge.create', finished_rendering);
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
Upvotes: 0
Views: 511
Reputation: 73984
The only way to check if a user liked a Page is to authorize the user with the user_likes
permission. You would have to go through Facebooks review process with that permission, and Facebook will definitely not approve the usage for your case, because what you are trying to achieve is not allowed. Like gating is not allowed since many years.
You must read the platform policy: https://developers.facebook.com/policy/
Upvotes: 1