Question

I get client events through a Facebook app. They launch the app and give me the permissions to be able to retrieve their events.

Every day I retrieve their events by using the token given by Facebook. No action required on their side.

After two months, I get the following exception : Error validating access token: Session has expired at unix time 1383568229. The current unix time is 1383569625.

I cannot ask them to launch the app again ; they will think there's something faulty with my app.

Also, I use a similar app which feeds one of my page using RSS (RSS Graffiti). It has never asked me to renew my token but still works after 2-3 years.

So it must be possible to make automatic renewals.

But so far, and after having spent hours on google and stackoverflow, I still haven't found a solution.

Any idea ?

PS: we are talking about a Facebook App, not a page.

Thanks.

Was it helpful?

Solution

As @CBroe said, it's not possible to automatically extend the validity of the tokens (see https://developers.facebook.com/docs/facebook-login/access-tokens/#extending).

Citation.

"Even the long-lived access token will eventually expire. At any point, you can generate a new long-lived token by sending the person back to the login flow used by your web app"

I'd recommend that you try to catch the error codes (see https://developers.facebook.com/docs/graph-api/using-graph-api/#errors) which will probably be error code 190 and error subcode 463 from the JSON error message and for example send the specific user an email with an invitation to revisit your app...

OTHER TIPS

As @Tobi has said, make your app interesting so that your users will return back to your app.

I cant understand why will the users think that your app is faulty? If your app doesn't need any user interaction and your users understands this, explain your users about this and notify them before the token is going to expire.

To notify, you may use the Notifications API- but please note that:

Your app should not send notifications to people who have not used it in the last 28 days. Data shows that engagement among this group is significantly lower. They are also the most likely to report your notifications as spam. Apps that receive a high degree of spam reports may be disabled.

(ref: Best practices)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top