I'm going to be writing a Facebook Graph script/application that will run as a cron. I tried to do this before, but it said that the access token expired. I tried using getAccessToken()
, but it told me that a valid access token had to be used to request information about the current user. How can I automatically renew my access token so my cron job won't break?
Asked
Active
Viewed 1,930 times
1

Steve
- 2,936
- 5
- 27
- 38
2 Answers
0
The normal access token expires in 2 hours, and the extended token lasts for 2 months. For the extended token guide, go though this: How to extend access token validity since offline_access deprecation
Now, the best thing you can do is to update regularly this extended token of the user when he log-in the app/website. So, you can use this token in your cron job. This will fail only when the user didn't visit your app for 2 months.

Community
- 1
- 1

Sahil Mittal
- 20,697
- 12
- 65
- 90
0
Did you verify expiry of your access token at below link?
https://developers.facebook.com/tools/debug
Moreover, you can get detailed answer by visiting similar question:

Community
- 1
- 1

Saurabh Sharma
- 317
- 2
- 11