Reputation: 313
I have a facebook app that tries to get a page's public info using the facebook graph api in php.
I got an app access token using this link https://graph.facebook.com/oauth/access_token?client_id={APP_ID}&client_secret={APP_SECRET}&grant_type=client_credentials
but when I use that to get a page's info I get a "400 bad request" response.
I connect to this: https://graph.facebook.com/{PAGE_ID}?access_token={ACCESS_TOKEN_FROM_PREVIOUS_CODE}
If I use the access token from the "Graph Explorer" app, it works but that is probably a user access token.
If I use the token that facebook generates with the oauth link above or the access token composed of "{APP_ID}|{APP_SECRET}" as they suggest in the access tokens documentation page it doesn't work.
In the page api reference they say an app token should be enough to get a page's public info.
Upvotes: 0
Views: 758
Reputation: 73984
I just tried it with an App Access Token (App-ID|App-Secret), it works perfectly fine like this:
https://graph.facebook.com/bladauhu?access_token=App-ID|App-Secret
If your page is not public, it will only work with a User Access Token (from a User who is Admin of the page). May be the reason why it does not work. Take App-ID and App-Secret from any App and make sure the App is public too ("Status & Review" tab in the App settings - "Do you want to make this app and all its live features available to the general public?").
Upvotes: 2