I keep getting logged out even though I have set a long session in auth0 dashboard

I keep getting logged out even though I have set a long session in auth0 dashboard. I use next.js.

I have set the session in the dashboard to 1 year, but I get logged out after a week. In the backend I have a function that fetches refresh and access token and updates the session based on these.
await updateSession(req, res, {
…session,
accessToken: tokenData.access_token,
refreshToken: tokenData.refresh_token,
idToken: tokenData.id_token,
accessTokenExpiresAt:
Math.floor(Date.now() / 1000) + tokenData.expires_in,
});

I can see that my appSession cookie get’s extended by a day at a time. Do I need to sync the nextjs-auth0 sdk with the auth0 configuration in some way?
Do I need to do a re-authentication of some sort to the nextjs-auth0 sdk?

Hi @gautelorentsen,

I recommend ensuring that your configured session lifetime settings have set a value in minutes for the Inactivity timeout and Require log in after settings.

After doing so, you can verify that it is working correctly by making sure you maintain an active session before the inactivity timeout or require login after settings are triggered. You should notice that your session persists and does not log you out.

You might need to silently authenticate users if you intend to persist their session without user interaction.

Please let me know if you have any questions.

Thanks,
Rueben

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