Facebook: get list of pages that a user is liked - javascript

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.

Related

How to get response from FB page like in angular 5

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

How can my website retrieve my Facebook page Live Videos?

If I go to the Graph API Explorer, get a User Access Token, and then go to /<page-id>/live_videos I can return a list of live videos from that page, including the status (VOD aka past, or LIVE) and the embed_html.
This is great but the problem is this User Access Token will expire. I want to be able to get this data as part of my website to show visitors whether we are live or not, and if so give them an option to open the video right there on the site. It shouldn't be something a user has to login in to allow my app to access FB on their behalf.
So I tried using an App Access Token which I got by using the App ID and App Secret of my page's 'Facebook App' as described in the Facebook docs here... but the Token that I get from this does not work; it tells me A user access token is required to request this resource.
Why must I get a User Access Token when it's my App (aka my website) that wants the data?
Honestly I didn't think it would be hard to get this information since it is a completely public page; I would have guessed you don't even need to authenticate, but probably just some need sort of identifying token for your app for rate limiting, etc. Is there any method like that?

Facebook API: user_feed is empty

So I was very happy when Facebook approved my Chrome Extension app. Basically, it allows you to import your data from facebook into the local_storage in Chrome, then you can easily search your old posts. While it works like a charm for my account, when I switch to another account, login, approve the Facebook request for permissions, my user_feed data is empty. I am at a loss.
I am able to get user info, the image of the user, his/her name, etc. and I am able to retrieve an access token. But, when I make the call to the feed, it comes back empty:
https://graph.facebook.com/me/feed?access_token=EAAcu...&expires_in&limit=50&offset=1&fields=message,likes,story,created_time,link
(I have also tried injecting the ID for "me"). Again, this works great when it's my FB account (also the developer account). So, I don't think it is my code, the only thing that changes is the user...
Perhaps it takes a certain amount of time for the Facebook API to work even after Facebook approves your permissions request??
Use the Access Token Debugger Tool to see if the access token that you are getting back has user_posts permission listed under "Scopes". If it is not present, then you cannot use that access token to fetch the user's feed.
Note that user_posts permission requires approval prior to usage. If you are not approved, it will only work for people who have admin/developer role in your app.
Got it. I didn't see this anywhere in the documentation, but in addition to having your app's permissions approved by facebook, you must also include the scope as a query parameter:
https://www.facebook.com/dialog/oauth?client_id=${appId}&scope=user_posts&response_type=token&redirect_uri=http://someresponse.com
If anyone sees this in the documentation, please let me know.

Facebook API - Pages - Get names of subscribers

I want to get the names of the subscribers of my facebook Page (I want to thank them and develop a single page website who mention each of them).
I use jQuery?
I have not find anything in the doc.
There is no API to get the fans of a Facebook Page. If you mean the followers of your User profile, that is not possible either. You should actually treat them as if they would be anonymous.
Btw, you would not be allowed to put them on an external website without their permission anyway.

OAuth and Facebook page tabs

I'm in need of more of an explanation than an answer, per se - I'm building a page tab, which will pull certain images from a particular album belonging to the page. This does not require an access token, so there is no need to ask for permissions from visitors.
I can add like/share options which also work fine without an access token or authorisation.
How do I get basic user info (id, name etc) without requesting authorisation? It's a page tab, on Facebook, so therefore the visitor must be logged in already.
Just seems counter intuitive if I have to request permissions to perform what is essentially pretty standard actions.
I'm using the javascript SDK.
It's a page tab, on Facebook, so therefore the visitor must be logged in already.
The user may be logged in to Facebook – but he is not necessarily connected to your app (yet). And you need him to be, to get his user id.
Make a call to FB.login without asking for any permissions in the scope parameter – that’ll prompt the user to connect to your app, giving it only “basic” permissions to read his personal data. That’ll give you his user id in the response.authResponse (and also will lead to his user id being included in the signed_request next time he visits your page tab).
After that, you can get his basic user info be calling /me via the Graph API.

Categories