Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to extend Facebook access token to 60 days

I am having trouble to extend the expiration time of Facebook access token to 60 days. I was reading several articles on Facebook developer page: https://developers.facebook.com/roadmap/offline-access-removal/

Specifically, I am using Facebook C# SDK, and when I ask for authentication, I am doing FacebookClient.GetLoginUrl(), and work on the call by to get the access token.

Right after that, I try to use FacebookClient.GetAsync("oauth/access_token") to extend the expiration time by using the following URL pattern

https://graph.facebook.com/oauth/access_token?             
client_id=APP_ID&
client_secret=APP_SECRET&
grant_type=fb_exchange_token&
fb_exchange_token=EXISTING_ACCESS_TOKEN 

However, I don't see the expiration time of the access_token being extended. I did set my app to use deprecated offline_access... Anyone have experience with Facebook C# SDK and could give me some thoughts on this?

Did I misunderstand the meaning of "extend expiration time" means in Facebook doc?

Thank you very much!

like image 825
Kane Ho Avatar asked Mar 24 '12 18:03

Kane Ho


People also ask

How do I get Facebook access token that never expires?

If you want to make sure your Facebook page access token never expires, click “Debug” button. If you can see “expires: never”, it means Facebook page access token will never expire.

How long do Facebook access tokens last?

When your app uses Facebook Login to authenticate someone, it receives a User access token. If your app uses one of the Facebook SDKs, this token lasts for about 60 days. However, the SDKs automatically refresh the token whenever the person uses your app, so the tokens expire 60 days after last use.

How long should access token be valid for?

By default, access tokens are valid for 60 days and programmatic refresh tokens are valid for a year. The member must reauthorize your application when refresh tokens expire.


2 Answers

The call you're making will return an access token, quite possibly not the same one you passed in. In other words, your existing token won't necessarily be extended, you may get a new one if required.

like image 156
Joachim Isaksson Avatar answered Oct 03 '22 13:10

Joachim Isaksson


Make sure you have enhanced oauth dialog enabled and your redirect_uri is pointing to your website.

like image 33
prabir Avatar answered Oct 03 '22 13:10

prabir