Search code examples
facebookfacebook-graph-apiaccess-tokenfacebook-access-token

Why does a new FB long-lived access token expire at the same time as the previous one?


I have a small misunderstanding with how FB access token is being refreshed.

I'm using FB JS SDK and every time I visit my page (as well as when I relogin) I get a new short-lived access token. Then I send it to the server side and exchange it to a long-lived access token.

But despite I get a new long-lived access token, it still expires at the same time as the previous long-lived token. Facebook Access Token Debugger says that token, I've just got, was issued 18 hours ago.

Is this a normal behavior? Or maybe I'm doing something wrong?

Greatly appreciate your help.


Solution

  • It looks like FB refreshes an expiration time of a new long-lived access token if user visits a page in one day after the initial long-lived access token is issued. In this case you can get a short-lived access token and exchange it for a long-lived token, which would have a new expiration time (i.e. 60 days).