facebookfacebook-graph-apitoken

How to get a Facebook access token for a page with no app or app secret


I am trying to automatically display wall posts from a Facebook page another website. I can use the Graph API explorer to get one manually. When I use the generated token in my code all is well. The problem is the tokens expire quickly. It just isn't practical to get a new code several times a day. I know there is a way to request an access token programatically - in my case via PHP, but all the examples call for an app secret. Since this is a page and not an app, there is no secret.

I have tried this:

https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=MY_CLIENT_ID&redirect_uri=http%3A%2F%2FMY_SITE_URL&scope=user_status

What I get back is this:

{ "error": { "message": "Error validating application. Cannot get application info due to a system error.", "type": "OAuthException", "code": 101 } }

I have tried using Fiddler to intercept the call from the Graph API explorer to see what I need in my code file, but haven't had any luck.


Solution

  • For graph objects that are not private (public) you can use your app_id as an access_token.

    Your app_id never changes so you don't ever have to renew it. The question is is the wall content yours?

    If so you can easily use your app_id to accomplish this without having to request an access token everytime.

    However, in order to have an app_id you need to create an application on facebook with a facebook developer account. As far as I understand there isnt a way to anonymously make request to the Graph API,