Facebook has a long-lived access tokens:
User access tokens come in two forms: short-lived tokens and
long-lived tokens. Short-lived tokens usually have a lifetime of about
an hour or two, while long-lived tokens usually have a lifetime of
about 60 days.
As you can see, even user's long-lived token will expire eventually. So it's up to you to either build a small tool to notify you when a token is about to expire or not. But in all cases, this can be done with cURL pretty easily (I have no ruby-on-rails experience): https://developers.facebook.com/docs/facebook-login/access-tokens#extending
- Start with a short-lived token generated on a client and ship it back to your server.
- Use the user token, your app ID and app secret to make the following call from your server to Facebook's servers:
GET /oauth/access_token?
grant_type=fb_exchange_token&
client_id={app-id}&
client_secret={app-secret}&
fb_exchange_token={short-lived-token}
PLEASE NOTE: that page access tokens generated from a long-lived user access tokens will NOT expire, see: https://developers.facebook.com/docs/facebook-login/access-tokens#extendingpagetokens
To get a longer-lived page access token, exchange the User access
token for a long-lived one, as above, and then request the Page token.
The resulting page access token will not have any expiry time.