9

I am trying to follow this tutorial on getting a token with longer expiration time . The Facebook connect is done on the client side (Js sdk). The steps I take are:

  • enabled 'deprecate offline_access' on my app settings page
  • retreive the access_token as normal
  • curl "https://graph.facebook.com/oauth/access_token?
    client_id=APP_ID& client_secret=APP_SECRET& grant_type=fb_exchange_token& fb_exchange_token=access_token"

This always returns the same exact same access token with expiration of 2 hours, shouldn't it return a token (same or not as access_token) that is valid 60 days ?

Thanks

2 Answers 2

6

As of right now, in my experience, it seems that the 60 day tokens are returned for new users who add the app after the 'deprecate offline_access' setting is enabled. Older users, from prior to setting the 'deprecate offline_access' setting seem to be stuck at 2 hour lifetime.

I also have some tests that seem to indicate that setting the 'Enhanced Auth Dialog' setting in addition to the 'deprecate offline_access' setting is required to get long lived tokens.

4
  • Awesome ! Thanks a lot @Greg_Whalin, the 'Enhanced Auth Dialog' was indeed necessary
    – jlezard
    Commented Jan 27, 2012 at 18:40
  • Also using client side (desktop) auth, have both "deprecate offline_access" and "enhanced auth dialog" enabled. After whole authentication process, I get access token valid for 60 days. BUT I am not able to extend the validity by calling mentioned endpoint. It always returns the same token with same validity < 60 days. Any suggestions? Commented Feb 4, 2012 at 19:50
  • i have both of these set and i got a 60 day token. but after that i removed the app from my app settings, and now i only get 2 hour tokens :( any ideas? Commented Feb 7, 2012 at 21:35
  • Sweet. To me it seems that removing the app from the user and adding it again did the trick.
    – PapaFreud
    Commented Aug 30, 2012 at 9:10
3

You can programmatically set the 2hour token as expired using HTTP DELETE to me/permissions, this will force the user to re-auth your app. Which should give you a 60 day token.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.