Facebook "The session is invalid because the user logged out" docs interpretation

时间:2017-08-04 13:12:45

标签: facebook facebook-graph-api facebook-javascript-sdk

I'm confusing about this error (take from facebook documentation) :

Access Token invalidated due to the person logging out or changing their password

{
  "error": {
    "message": "Error validating access token: The session is invalid 
                because the user logged out.", 
    "type": "OAuthException", 
    "code": 190
  }
}

If the access token becomes invalid, the solution is to have the person log in again, at which point you will be able to make API calls on their behalf once more. The login flow your app uses for new people should determine which method you need to adopt.

This is the case: users visit my site and log in with facebook -> i obtain a user access token -> i exchange this short-life user token with a 60 days token -> every day a cron job made a call to facebook to get like counts of some user's posts by the long life token i have retrived from facebook.

It works but , maybe some day later, if a user hit the logout button on his facebook profile page, my long-life token stops to works and return the error.

My question is, if the user re-login in his facebook profile page, my long life token will restart to works? Or the user needs to visit my site again and then relogin to give me another short-life token that i can exchange with a new long-life token?

if i need to request a new long life token, there is an alternative that i can use to maintain a token valid for a month at least, without requesting the login to the user again?

0 个答案:

没有答案