Is there any way to use the facebook graph api to find out when a page access token will expire?
There is now an API version of the debugger tool. See https://developers.facebook.com/docs/authentication/access-token-debug/.
But I can't figure out the expire_date
of my page_access_token
. Please how can I find when token will expire in ASP.NET or Javascript.
In below picture I was figure out just the page_access_token and the id.
Thanks.
You cannot get access token directly, however you can call debugging api
GET /debug_token?input_token={input-token}&access_token={access-token}
which will get your the time, the Access expier_at
, you can check the details in this link
https://developers.facebook.com/docs/facebook-login/access-tokens/debugging-and-error-handling
API response contains
{
"data": {
"app_id": 000000000000000,
"application": "Your ApplicationName",
"expires_at": 1352419328,
"is_valid": true,
"issued_at": 1347235328,
"scopes": [
"email",
"user_location"
],
"user_id": 1207059
}
}
Note that the issued_at field is not returned for short-lived access tokens
Access token is expiration is of 60 days, for creating token that never expire follow this answer here
https://stackoverflow.com/a/35481577
I will say better read this article, http://appdevresources.blogspot.com/2012/11/extend-facebook-access-token-make-it.html to make extended tokens (Generate long-lived token for admin of the fan page )
http://appdevresources.blogspot.com/2012/11/retrieving-facebook-page-id-and.html (Generate long-lived token for fan page itself)
Resulted token will never expire (even if administrator of the fan page did log out)
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly