Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook graph API - getting wall posts

I am having trouble getting the hang of the facebook graph API and reading my wall post.

I've created a facebook app and from it now have an App ID and AppSecret, using those, I get an access_token via this url: https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=MYAPPID&client_secret=MYAPPSECRET

example: access_token=12313231321312312312

so then I make the call here:

https://graph.facebook.com/MYFACEBOOKID/feed?access_token=12313231321312312312

however the results I see are not the list of items that are on my wall. Example I made a post today and it's not in that result. The only thing listed there is a friend I added about 2 weeks ago, and nothing else.

If I go to https://developers.facebook.com/tools/explorer and type in the textbox put in /MYFACEBOOKID/feed and submit, then I see the full results of what I would like to get above (using the app secret etc). If I copy the access_token from the explorer page and put that into my url, then I also get the full results.

So wondering what am I missing? Do I need to add permissions somewhere, so I can get the same results using the AppID/AppSecret method to request the access_token?

Or do I just use the access_token from the explorer page in my code?

like image 502
Karen Avatar asked Nov 12 '22 08:11

Karen


1 Answers

grabbing the access token from the graph explorer is not an answer. You can check though and see if the access token there (select your app, not the graph) is the same that you get with the url. For the authorization URL, have you tried something like the following?

https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=user_likes,user_status,publish_actions,read_stream,ETC_ETC_OR_WHATEVERELSE&response_type=token"

This works fine for me so it's worth giving a try. I also see here that it can still be done this way (not considered bad practice as far as I can see). Yes you need permissions in other words.

like image 61
tattvamasi Avatar answered Nov 15 '22 13:11

tattvamasi