Logged out after the cookie `auth0.is.authenticated` expires

Hi. Sorry if this is a duplicated issue, if so please point me to the original one.

We are using auth0-spa-js to authenticate users.

Every time a user logs in, the cookie auth0.is.authenticated is set to true with 1 day until expire. Then, when the user refreshes the page or return to the website, the lib checks the presence of this cookie before perform a getTokenSilently.

After the cookie expires, the lib does not call the getTokenSilently again, even though there’s a chance of the in-memory token still be valid (according to our API settings on Auth0).

Here is my question: Does the auth0-spa-js lib should be capable to recognise the user is logged in for a period longer than 1 day when there’s a valid token? If not, how can we keep the user logged in for a longer period?

3 Likes

For future reference, I figured out that you can set the sessionCheckExpiryDays so that the cookie is set for the number of days that you provide.
https://auth0.github.io/auth0-spa-js/interfaces/auth0clientoptions.html#sessioncheckexpirydays

1 Like

Hi @brianz,

Welcome to the Community!

Thanks for providing a solution for this :grinning_face_with_smiling_eyes:

Thanks @brianz ! :slight_smile:

I proposed and implemented the sessionCheckExpiryDays, but I completely forgot to update this issue.

1 Like

@luisfelipe glad you got a solution working, regardless!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.