Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get public page statuses using Facebook Graph API without Access Token

I'm trying to use the Facebook Graph API to get the latest status from a public page, let's say http://www.facebook.com/microsoft

According to http://developers.facebook.com/tools/explorer/?method=GET&path=microsoft%2Fstatuses - I need an access token. As the Microsoft page is 'public', is this definitely the case? Is there no way for me to access these public status' without an access token?

If this is the case, how is the correct method of creating an access token for my website? I have an App ID, however all of the examples at http://developers.facebook.com/docs/authentication/ describe handling user login. I simply want to get the latest status update on the Microsoft page and display it on my site.

like image 772
christofr Avatar asked Oct 03 '11 09:10

christofr


People also ask

How do I get Facebook Page Insights on graph API?

You can access Page Insights by typing /insights after the name of your page in the URL field. This command will retrieve all of the Insights associated with your Page. Type "/insights" after your company name. Click the Submit button.


2 Answers

This is by design. Once it was possible to fetch the latest status from a public page without access token. That was changed in order to block unidentified anonymous access to the API. You can get an access token for the application (if you don't have a Facebook application set for your website - you should create it) with the following call using graph API:

https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET& grant_type=client_credentials   

This is called App Access Token. Then you proceed with the actual API call using the app access token from above.

hope this helps

like image 167
Anatoly Lubarsky Avatar answered Sep 20 '22 00:09

Anatoly Lubarsky


You can use AppID and Secret key to get the public posts/feed of any page. This way you don't need to get the access-token. Call it like below.

https://graph.facebook.com/PAGE-ID/feed?access_token=APP-ID|APP-SECRET 

And to get posts.

https://graph.facebook.com/PAGE-ID/posts?access_token=APP-ID|APP-SECRET 
like image 43
Hassan Siddique Avatar answered Sep 19 '22 00:09

Hassan Siddique