0

I'm an admin for a Facebook page I want to handle a server side job scheduler which post every specific time into that Page using Facebook Graph API.

I'm using this code to do that job: $facebook->api("/$page_id/feed","post",$args); and it is working fine for me.

But I have a problem related to Page Access Token. I need to have a permanent Page Access Token to work forever not to update the access token every specific time because it will be server side job scheduler, no GUI for it.

Any suggestion about how to get Permanent Page Access token?

Note: I followed the steps in Facebook documentation but I have 3 wanderings about it :

  1. Shall I have Facebook app to get Long-Lived Page Authentication ??
  2. I don't have that option on my Facebook app advanced setting "deprecate offline_access" ??
  3. Is the 60 days is the max valid duration which I can give it to Page Access Token .. can't it become permanent for ever ??
Chris McFarland
  • 6,059
  • 5
  • 43
  • 63
  • You can get a permanent token: http://stackoverflow.com/questions/17197970/facebook-permanent-page-access-token/17234650#17234650 – Josh Oct 25 '13 at 03:20

1 Answers1

1

Earlier people could use offline_access permission to obtain a permanent token. But it looks like Facebook is deprecating this particular permission. Instead, you first need to obtain a short-lived token, then exchange it for a long-lived token, which remains valid for 60 days. Same goes for page tokens.

When a user grants an app the manage_pages permission, the app is able to obtain page access tokens for pages that the user administers by querying the [User ID]/accounts Graph API endpoint. With the migration enabled, when using a short-lived user access token to query this endpoint, the page access tokens obtained are short-lived as well.

Exchange the short-lived user access token for a long-lived access token using the endpoint and steps explained earlier. By using a long-lived user access token, querying the [User ID]/accounts endpoint will now provide page access tokens that do not expire for pages that a user manages. This will also apply when querying with a non-expiring user access token obtained through the deprecated offline_access permission.

https://developers.facebook.com/roadmap/offline-access-removal/

Salman
  • 3,761
  • 2
  • 23
  • 34