This is a rather infuriating problem. We had code that was working perfectly fine for months and now, all of the sudden, it doesn’t. The code just used this url to grab the wall posts we were making on our fan page and showed them on our site. http://graph.facebook.com/%5Bour number]/feed?limit=10
Now it doesn’t work and I’ve spent a ridiculous number of hours sifting through search results on this issue. Unfortunately, everything I find seems to be referring to Facebook apps and not fan pages. I can’t stop seeing how I need to authenticate it using my secret key, but I can’t find anything that shows me what my fan page’s secret key is or if one even exists. I can’t, for the life of me, get this thing working and I can’t figure out why it just randomly stopped working in the first place.
Here’s the error we get:
{
"error": {
"type": "OAuthException",
"message": "An access token is required to request this resource."
}
}
EDIT: So thanks much to Frank Farmer for finding that post, the problem is needing an access token, which I can’t find ANY solution to getting ANYWHERE.
The way that I was able to do this was by:
Opened up a request for permissions for the application
https://www.facebook.com/dialog/oauth?client_id=‘the_application_id’&redirect_uri=http://your_redirect_uri/&scope=email,read_stream,user_birthday,user_about_me,user_likes,read_stream,user_education_history,user_work_history,user_groups,user_hometown,user_religion_politics,user_location,user_online_presence,user_relationships,user_status,user_website,read_friendlists,offline_access,manage_pages,ads_management,publish_stream
Your redirect URI MUST match what you have set into the application settings in your facebook application.
-After that you will need to copy the ‘code=xxxxxx’ portion of the link that you are forwarded onto after accepting the permissions request. You can THEN request an access_code for the user, once you have that, you can get the Facebook page posts that the user is an admin to.
https://graph.facebook.com/feed?access_token=‘your_access_token’
Below is some sample code you can use with the PHP facebook SDK: