Today, I have seen a post in the Facebook developer forum asking how long will an app access token be valid for.
Should be ~2 hours…. but wait! That’s the value that comes into my mind right after I say this post BUT this is for user access token. So, I try to check this out in facebook’s documentation.
According to the App Login section of the Facebook Authentication doc,
You can obtain the app access token from the Graph API token endpoint at
https://graph.facebook.com/oauth/access_tokenby specifying your app id, app secret and client_credentials in the grant_type parameter.
Sending an HTTP GET request to the above URL will return an access_token in the body of the response:
However, it does not mention or include expiry time for the token.
Well, my conclusions are
- While the application access token allows us to take various administrative actions for app, such as retrieving Insights data, I would simply use the same access token for my “application session”…. at least I won’t keeping using the same session for viewing my app’s insights data for hours. And in the next session, my app code will simply get another access token.
- I won’t store the application access token in local database as I store user access token obtained with offline_access permission granted.
Of course, you have may different needs… but have you ever experienced an “expired token” error then?