Search code examples
facebookfacebook-graph-apifacebook-fqlfeed

How to show your own facebook data on a website


I got "The question you're asking appears subjective and is likely to be closed." when I started to write my this and a lot of similar titles popped up.

So I've browsed them all and only two might actually help me solve the problem, but they weren't answered.

So... I will continue to ask my question and hope that it wont be closed.

Here it goes:

All I want is to show the feed of a facebook page on a separate website. I.e. status updates, photos, videos, events, comments and likes, all public.

I've googled and also looked at some docs on the facebook developer pages, but all I found was about how to make the visitor grant my fb-app rights to do stuff. Then I would get an access_token which I could use, BUT this token expires.

Never mind... I DONT want to make the visitor grant stuff, I only want to show MY stuff, which is already public.

Preferably I would like to do it with javascript and ajax. PHP might not be supported where I have my site. So if you have an answer for me please say it in javascript first :)

Although ALL answers are more than welcome.

Please, pretty please, with sugar on top, help me with this one.


Solution

  • Getting public data of a facebook page is easy, you don't even have to own the page for that.

    You will need a facebook application for that, once you have that you can then authenticate against facebook as the application (from your servers) as explained in the Authenticating as an App guide. You can try it with a simple curl request to:

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

    After you authenticate you receive an app access token and you can use it to make api requests for public data.

    For example, try the South Park page object, feed connection, photos connection and events connection. The token used in the graph explorer is a user token, but you can paste there the access token you got from the curl request for example and it will work.