Why is facebook php sdk not managing token lifetime?

The facebook developer docs state the following:

The official Facebook SDKs manage token usage times for you. When using iOS, Android or our JavaScript SDK, the SDK will handle making sure tokens are updated before they expire. ( https://developers.facebook.com/docs/facebook-login/access-tokens )

So it is obvious that their client SDK is actively handling refresh tokens before they expire, but not their server side SDK .... (?)

And indeed, I have a website that uses their php sdk - and about every 2 hours, I try something on my site, and my api call throws a FacebookApiException: "The request should use the active access token information about current user. " On page refresh, the token seems to be renewed and the api calls work again.

Why is this, or more importantly, how can I proactively refresh tokens before they expire when using php sdk (to avoid page crashes once every 2 hours)? I would rather not use the javascript sdk


source to share

All Articles