Get And Use Facebook Offline_access Tokens
Jun 14th, 2011Access token allow a client app to access users information and take action on their behalf on Facebook.
With the Facebook PHP SDK v3 (see on github), it is
pretty simple to deal with offline_access
access tokens. To log
someone with the offline_access
permission, you ask it when your
generate the login URL. Here is how you do that.
Get the offline access token
First you check if the user is logged in or not :
If he is not, you generate the “Login with Facebook” URL asking for the
offline_access
permission :
And then display the link in your template :
Then you can retrieve the offline access token and store it. To get it, call :
Use the offline access token
To use the offline access token when the user is not logged in :
And now you can make API calls for this user :
I wrote this page after an answer I made on Stackoverflow.