Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh access token without user intervention

I am using facebook sdk for android to fetch the FB data. The access_token that is received after successful login expires after a certain time. I want to refresh the token token in the background. ie; the user should nt be prompted for the credentials again. Thanx in advance

like image 246
AndroidGuy Avatar asked Feb 21 '26 12:02

AndroidGuy


2 Answers

I hope you can not refresh the access token without the user prompt, becuase it means everybody able to do things without request permission.

If you call the auth process after the access token timedout, it takes just 1 sec, and usualy just a blink on the screen.

Please note that the access token could expire before the expire date. For example the user just logout in another window. Moreover the offline token could expires if the user changes her/his password.

So just call the standard auth url, and your access token will be refreshed.

like image 66
Sándor Tóth Avatar answered Feb 23 '26 02:02

Sándor Tóth


You can get a token that doesn't expire. Just add offline_access to the requested facebook permissions of your app.

Check the permissions documentation.

As pointed out by Kostadin, this way seems to be gone now.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!