How Long will an Facebook App Access Token be valid for?

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_token by 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?

This entry was posted in Authentication, Development Tips, Facebook Dev Forum Digest and tagged . Bookmark the permalink.

One Response to How Long will an Facebook App Access Token be valid for?

  1. alejandro says:

    Hi,
    thats whats my question too, i dont know if i can store it on my db/txt to avoid onr more requesto facebook.

    today i’m gettins some errors if i try to change app subscriptios.
    “(#10) Apps must have at least 100 users to use this API ”
    do you know why is this?? yesterday it worked without problem :S

Leave a Reply

Your email address will not be published. Required fields are marked *