Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Facebook app: access token expiry ( expires_in ) is always 0


I am developing an app which uses facebook integration. I am trying to receive the access_token and expires_in tokens from the facebook library classes. Once i am logged in I get the access_token correctly but i always get expires_in token always 0. And because of that I isSessionValid() method always returns false. Kindly let me know if anyone has faced this issue and solved it.

My code runs perfectly fine when i do not have the Facebook app installed in the emulator. I get the webview and I can log in and update status. But when I install Facebook app, clicking on the update status menu option opens the Facebook app, I get redirected to the permissions page and then I get an error saying " Failed to receive access token". This is infact because of the expires_in token being 0.

i do not want to ask the users of the app to uninstall the Facebook app if they have installed. kindly let me the solution to this problem.

Thanks,
Punit

like image 671
Gadenkan Avatar asked Oct 10 '11 09:10

Gadenkan


1 Answers

If you put permission offline_access, the token expiry is 0.

For any one else having this issue (if you had put offline_access permission and later removed) follow the steps:

  • Go to your facebook profile setting and remove your app.
  • and then do login again.
  • Give permission to your app again.

Alternately you can do this:

  • Go to your facebook profile setting > Apps > Your_App and remove "Access my data any time" permission.
  • Save changes made.
  • Re-run Your_App(i.e. with no offline_access permission now).
like image 50
Adil Soomro Avatar answered Nov 15 '22 17:11

Adil Soomro