I am using ngx-facebook for implement FB page like. I want to know if my FB page was liked or not to perform some action on basis of response.
I followed "https://www.npmjs.com/package/ngx-facebook" tutorial to implement FB like.
Rewarding users in any way for liking a Page is not allowed. The only way to know if a user liked a Page is to authorize that user with the user_likes permission. After that, you can check if the Page is liked. You will not get that permission approved by Facebook though, if you reward users for liking, or gate content behind likes.
TL;DR: It´s not possible and not allowed for your use case.
More information: https://developers.facebook.com/docs/apps/examples-platform-policy-4.4
Related
I'm using the Javascript SDK.
I have a logged in user, and want to get back a list of page ids of all the pages that the user is likes.
Is there a way of doing this? The docs are pretty bad - and circular.
https://developers.facebook.com/docs/graph-api/reference/user/likes/
Do note that Facebook is very restrictive on the user_likes permission that is required to access this endpoint. Facebook policies forbid "like gating" - requiring a user to like a page to access content or otherwise be rewarded.
I have configured fb like box (likes my page) on my website. It works fine. Stores the details of the user in DB. But when a user actually actually goes to the facebook page and likes it, the edge.create wont fire. Please offer a foolproof way of storing the details of users who like my facebook page from anywhere (website like box/actual facebook page)
You would need to authorize users on your website with the user_likes permission. user_likes requires approval from Facebook, so it depends what you want to achieve. If you want to use it for like gating, you will not get it approved - like gating is not allowed anymore.
After authorizing, you can get the likes with /me/likes: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/likes
More information about user_likes: https://developers.facebook.com/docs/facebook-login/permissions/v2.2#reference-user_likes
I'm making the Facebook app whit JavaScript SDK, and I need user likes permissions to make a like gate. When I go to my app for the first time I get the popup whit permissions and big red alert: "The following permissions have not been approved for use and are not being shown to people using your app: user_likes " When I submit my permissions for approvement they reject me... Is there another way to make a like gate?
If you're having a Page Tab App, then use the signed_request data. If not then you'll need the permission to be able to access the User's likes.
Have a look at my answer here: perl Facebook::Graph API check if user likes page
I have built a simple webpage in PHP. I want to tell if users like my page (I placed a like button on it). It is not a Facebook app. I have seen this, but don't know how to use it with PHP. I don't know JavaScript at all. I tried pasting the code listed at the link into my page, but it didn't do anything useful.
A PHP solution would be preferable. I don't want to build a Facebook app, I just want to know if the Like button has been pressed.
Any help would be appreciated. Thanks!
Edit: Here's the link to my website, per answerer request: testingground.comyr.com
Those Edge events are only usable to detect if the user clicked the Like Button right now, but you cannot check if he already liked your page. That is only possible with an App, and user authorization with the "user_likes" permission.
More information:
Check if logged in user has liked my Facebook Page
Check if user liked page or not
Why don't you use the Facebook developer reference documentation?
Without an API Access, I think there is no possibility to do that.
How should you have access the private token what a random user liked?
Ok so i've tried the following:
FB.api("/me", {fields: "picture"}, function(response){
console.log(response);
});
And i'm trying to work around http://graph.facebook.com/USERNAME_OR_USERID/picture since obviously i don't know the users ID prior to authenticating.
All i want is a "modern" feel within the website, so i'd like to present the user with his or her's profile picture on the "login" div presenting the facebook login button. Is this possible? I know that Facebook and their graph api prohibits most such features but i would hope that a public profile picture would be accessible through the graph API..
I've Googled around and all the solutions say "use the USERNAME in the URL and you're fine" but i'm not, so to clear out any doubts, is this possible?
Error message: An active access token must be used to query information about the current user.
You can get everyone's Facebook profile picture without authentication.
You just call http://graph.facebook.com/USERNAME_OR_USERID/picture?type=large. This URL redirects you to image URL.
Type may be normal,small or large.
I also have questions for you:
How do you want to display the picture of someone without knowing who he/she is?
How can you guess which account the visitor will use to connect?
It looks like you want to know whose Facebook account was lastly connected on the browser of your visitor. Technically, you would want to read another site's cookies, which is 1) not allowed 2) impossible.
Several additional things you need to know:
http://graph.facebook.com/USERNAME_OR_USERID/picture is a public way to retrieve someone's photo. You don't need a token for that. What else do you need?
Using FB.API("/me", ...) from the JS SDK implies that "me" represents the connected user. It cannot just be used alone.
By the way, identical questions have already been answered and accepted:
Facebook app without prompted authentication
Get Facebook user's profile picture prior to authenticating app
Why would you hope the impossible?