I would like to know if it is possible to have an access token that never expires for post to my page
Now I get the access token with:
https://graph.facebook.com/me/accounts
I have publish_stream and manage_pages permission, but using the Access Token Debugger I see that the token expires in about 1 hour. Is there a way to never expires?
See facebook developers:
So, you have to exchange your initial shortlived token for a longlived token with a server side call:
And then query me/accounts with that longlived token. Definitly works for us, i.e. the debugger shows: ‘Expires: Never’
edit – our process
So, what we do is:
first client side authentication with our app where we get a “code” back after the user accepts the requested permissions and connects his account with our app
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID &redirect_uri=YOUR_REDIRECT_URI &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES &response_type=code
Now in our server application we use server side authentication to exchange code for access token:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID &redirect_uri=YOUR_REDIRECT_URI &client_secret=YOUR_APP_SECRET &code=CODE_GENERATED_BY_FACEBOOK
With this access_token we do the server side exchange as described above
Now we request me/accounts and the resulting access_token is always valid
Hope that helps