0

I'm using the

https://graph.facebook.com/oauth/access_token?client_id={app_id}6&client_secret={app's_secret}&grant_type=client_credentials

to generate a token to read the feeds of a certain page using:

https://graph.facebook.com/148321325216424/feed?access_token=xxxxx

where xxxxx stands for the retrieved token from the first call. In return I received and empty json array with no data in it.

If I go to the https://developers.facebook.com/tools/explorer page and while login in facebook I use the "get token" button (my user button) I get a valid json array.

Does someone know if the apps tokens are still valid to read feeds ?

Luis M. Valenzuela
  • 149
  • 1
  • 2
  • 10

1 Answers1

0

For reading the feed of a Facebook Page, you can just use an App Access Token:

$appToken = $appId . '|' . $appSecret;

Only do this on the server though, protect your App Secret.

Of course it has to be a Facebook Page, and the Page has to be public. I cannot access that ID, so it is either not a Page or it is unpublished. The Page must be unrestricted too (country/age).


If you want to get the feed of a User Profile (mind the difference between "Facebook Page" and "User Profile"), you would need a User Access Token with the "read_stream" permission, of course. That would be a lot more complicated, because User Tokens are only valid for 2 hours - you can extend it to 60 days though. Also, "read_stream" will ony get approved by Facebook for "platforms without a native Facebook client" (Smart TVs, for example), so it will only work for users with a role in the App (Developer, Admin, Tester).

In case you need more information about the Tokens, here are some links:

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • So the call should be: `https://graph.facebook.com/148321325216424/feed?format=JSON&access_token={appID}|{appSecret}` If so, it's still returning an empty json array... – Luis M. Valenzuela Sep 24 '14 at 20:20
  • i´ve added more info in my answer, the app token is correct but the page isn´t. – andyrandy Sep 24 '14 at 20:26
  • This is the page... `https://www.facebook.com/pages/Abric-Colección/148321325216424` It's been publicated, it's public and it's available for all countries... – Luis M. Valenzuela Sep 24 '14 at 20:45
  • is the page restricted somehow? (country/age) – andyrandy Sep 24 '14 at 20:58
  • Found a temp way to solve the problem: - I've followed this guide `http://stackoverflow.com/questions/12168452/long-lasting-fb-access-token-for-server-to-pull-fb-page-info` - As a result I've got a 60 day access token - In the same guide mentions that if you request using your app page permissions for manage_pages it will give you a permanent access token that can be used in the php class – Luis M. Valenzuela Sep 24 '14 at 21:19
  • the page must be age or country restricted then, as it only works with a user access token (the 60 days valid one). you can read more about page access tokens (that is not what you are using, because it´s either valid for 2 hours or forever) in the links i posted. – andyrandy Sep 24 '14 at 21:51