0

Possible Duplicate:
How to extend access token validity since offline_access deprecation

I try to get a long life access token (60 day expiration time) for my application. But all my tests give me only a short token.

What i do :

  • First a do a classic "authentication" to get a short-life access token. So the url : GET graph.facebook.com:443/oauth/access_token?redirect_uri={my_callback}&code={the_code_given_by_fb}&client_id={my_client_id}&client_secret={my_client_secret}

=> Give me two data access_token (a long string) and expire ( about 4000 seconds)

  • Then i want to transform my short life access to long life access, so i have try to call :

GET graph.facebook.com:443/oauth/access_token?redirect_uri={my_callback}&code={the_code_given_by_fb}&client_id={my_client_id}&client_secret={my_client_secret}&fb_exchange_token={short_life_access_token}&grant_type=fb_exchange_token

=> This call give me, the same data that the first call (so no long life token)

I try also : GET graph.facebook.com:443/oauth/access_token?client_id={my_client_id}&client_secret={my_client_secret}&fb_exchange_token={short_life_access_token}&grant_type=fb_exchange_token

=> Same result

So i didn't understand what must we do, to get a long life access token ?

Community
  • 1
  • 1
MLKiiwy
  • 133
  • 1
  • 8

1 Answers1

0

You have done correctly. You have extended the short lived access token. Now store that in Database and use it. After 60 days, page admin user will have to come back to your app in that 60 days to get a new access token with the extended time on it.

FYI offline access removal

From the DOC

    If you pass an access_token that had a long-lived expiration time, the endpoint will  
 simply pass that same access_token back to you without altering or extending the expiration time.
Venu
  • 7,243
  • 4
  • 39
  • 54
  • It's very strange ... the expires indicate about 4000 second for all the token ? So the expires data is not correctly returned ? – MLKiiwy May 24 '12 at 13:02
  • did you enable 'deprecate offline_access" in your Advanced settings of the Developer App? – Venu May 24 '12 at 13:08
  • No, but after enabling 'deprecate offline_access', i still have a short token after the second call (expires equal to 4000s) – MLKiiwy May 24 '12 at 13:59