facebookfacebook-javascript-sdk

set expire date in Facebook login


About the Facebook SDK. Which parameter I could use to set the session expire date?

I got this error:

Error validating access token: Session has expired on Wednesday, 25-May-16 10:00:00 PDT. The current time is Friday, 27-May-16 02:19:23 PDT

My login code is like this:

FB.login(function (response) {
    if (response.authResponse) {
        // user just authorized your app
    }
}, {
    scope: 'public_profile,user_friends,email',
    return_scopes: true
});

Thanks a lot in advance


Solution

  • You can´t set the expiration date on your own. A User Token is valid for 2 hours. An Extended User token is valid for 60 days.

    More information about Tokens and how to generate them:

    In general, you don´t need to worry about Tokens when using the JS SDK.