Pergunta

I'm writing code to allow uploading of events from a website to facebook, to do that I require a manage page access token, the procedure I`v found to obtain that is:

First Having added the domain to the app:

Then get a short term access token with:

https://www.facebook.com/dialog/oauth?client_id=[App ID]&redirect_uri=[full website uri]&scope=create_event&response_type=token

Then get a longer lasting access token from:

https://graph.facebook.com/oauth/access_token?client_id=[App ID]&client_secret=[App Secret]&grant_type=fb_exchange_token&fb_exchange_token=[access token given above]

Then get a page specific token from:

https://graph.facebook.com/me/accounts?access_token=[access token given above]

That returns a json encoded array with tokens for each page I manage which I gather lasts for 60 days.

However I don't manage the website I`m coding for, so don't wish to have to repeat this manual procedure every 2 months, can someone give an idea for an automated procedure or to confirm if such is not possible with facebook.

Foi útil?

Solução

If you are extending the user access token then the page token received will not have an expiry date. So then the user will only have to login once in the entire usage of the app.

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/

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top