Can someone explain to me how to get a facebook token to extract posts from public pages? I don't understand how to get it. I use the Graph API and select the user_posts feature.
I believe I then have to submit the app to Facebook, but I need a logo to do that?! Please help!
user_profiles is for User Profiles, not Pages. You need to use manage_pages and a Page Token for Pages you manage, or apply for Page Public Content Access with an App Token for pages you do not manage.
More information about Tokens and how to generate them: https://developers.facebook.com/docs/facebook-login/access-tokens
Related
I'm facing trouble in getting access_token which I need to use in displaying ANY facebook feed on the website.
I have followed the instructions here in that given link, facebook: permanent Page Access Token?, but sadly not worked for me.
Below are my API details and my requirement is to display ANY facebook page posts via PHP code in my website.
App ID: 1250216098473345
App Secret: c637f7640a185b8137e567295abe568f
All I need is a non-expire access token to put in my code to display feeds.
$userPosts = $fb->get('/ESPN/posts?fields=story,shares,likes.summary(true),comments.summary(true),full_picture,permalink_url,message,updated_time&limit=8', $accessToken);
Tried given tokens to display data of public fb pages, but failed.
https://graph.facebook.com/oauth/access_token?client_id=1250216098473345&client_secret=c637f7640a185b8137e567295abe568f&grant_type=client_credentials
https://graph.facebook.com/oauth/access_token?client_id=1250216098473345&client_secret=c637f7640a185b8137e567295abe568f&grant_type=fb_exchange_token&fb_exchange_token=EAARxEJ5xJYEBAGXFLgn98sPHGqZA74pkipbxLPTCn0jx7vtZBipmoPcG7CYaBXqRol2IUhtAI9wlX4bpFOJ1oGWSEmucCzUYKQnCwH42BnCEZARuIgEPGR3r0ZCjvI343S5yLd1C8mPLQJHNKiAOskwhmP4FU0ZC6eEvVOZB1XnWYleZA639EntpCYedUNp9itjy9c2joZBZBqAZDZD
First of all you shouldn't share you app secret publicly (hence the name).
There is no token that would allow you to display any Facebook page feed. Looking at your example call you most likely refer to pages you or your app users don't have a role in therefore you can apply for Page Public Content Access feature which then would allow you to access public page's data/feeds.
The other option would be requesting manage_pages permission from a page admin for the specific page you want to access.
When I am trying to subscribe a page to my facebook application, the application is asking for manage_pages permission. I am sending a post request to /{page-id}/subscribed_apps.
I am looking for a way to subscribe to a page and configure webhook for only public page information without asking for manage_pages permission. Is there any way to do so ?
Thanks in advance!
A Page Access Token is required for all methods.
Since you can only get a Page Token for Pages you manage, there is no way to subscribe a Page to an App without managing it.
Source: https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps
I have a website that query Facebook graphApi and get the available public data of pages.
I have some profiles, where graphApi does not return any data i.e. post/status data marked public on profile.
Even when I try to visit profile manually i.e. by typing url in IE - https://www.facebook.com/ndalloul, it redirects me to Facebook login page.
But when I do it manually i.e. login to my Facebook Account and try to view the profile Ex:https://www.facebook.com/ndalloul shows me the data marked as public.
How to get this data from Facebook using API or Library?
Any help is appreciated.
Thanks.
Apart from the fact that Facebook is switching to the Graph API 2.0, you should not get any kind of redirect to login if you use your app access tokens and talk to the graph via cURL 8ro qeuivalent) .
The endpoint to get public statuses from fan pages, is page_id/feed/ You need an access token from an app with with read_stream permission and only those who grant you that permission will show the latest posts. More info here
You may now have to be approved by facebook to read the stream, by the way.
I'm using a facebook extension in TYPO3 to pull out the facebook posts of a page. Therefor I need the accesstoken.
I googled around and found that I need a facebook app and I need to be administrator of the page.
Then I heard that I need to connet the app with the site, but how can I do this?
I also tried to get accesstoken:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials
And then performing:
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token& client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-token}
... with this token but it says No user access token specified
Can someone help me step by step how to get the long lived token?
As you just want to pull, you really don't need a page access token. Until and unless you have a demographic or other restriction over your page. All the pages are Public and data over them can be easily accessed by using the App Access Token which is simply put
Your_App_ID|Your_App_Secret
first u need to get an API key from facebook, so here are the steps--->
http://www.shoutmeloud.com/how-to-acquire-your-facebook-api-key.html
& then u can access facebook API, these are docs provided by the facebook to use that API--->
https://developers.facebook.com/docs/guides/web/
This was my implementation (PHP):
$newposts = json_decode(file_get_contents("https://graph.facebook.com/YOURFBPAGE/feed&access_token=YOURAPPID|YOURAPPSECRET"));
Since I was only using this to make simple pull request of my feed posts this is the best way to do it. You don't have to deal with expiring access tokens. Just create your facebook App and get the ID and secret.
My app's only purpose is to make posts as Facebook pages, so we'd like to take user login out of the flow.
If the user adds our app to their page using a link like http://facebook.com/add.php?api_key=APP_KEY&pages=1, how would I get an access token to make posts as that page?
Thanks :)
At least one of the page's admins has to authorize your app with both manage_pages and publish_stream permissions. (see https://developers.facebook.com/docs/reference/api/permissions/)
Then once you get their access token, call the graph with me/accounts and in that list will be the page. (see the Page Login section of https://developers.facebook.com/docs/authentication/) In there will be a page access token for managing that page. So then you can HTTP Post to me/feed a new message using that page access token.
Happy coding!