Setting updateAge greater than maxAge: a valid approach? #12293
Unanswered
lukemorton
asked this question in
Help
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
As far as I can tell, Auth.js/NextAuth rolls sessions forever. As long as the user interacts with the session within
maxAge
, the session will be extended everyupdateAge
indefinitely.By default, as long as a user interacts with the session within 30 days (default
maxAge
) the session is extended every 24 hours (defaultupdateAge
).But what if you want to force the user to login every say 14 days?
My initial thought is to set the
updateAge
to be greater than themaxAge
. This would mean the session is never extended as theupdateAge
would not be reached before themaxAge
. The impact would be 1) the session expiry never extends and 2) when the expiry date is reached the session would no longer be valid, logging the user out.Imagine we set
maxAge
to 14 days andupdateAge
to 15 days:updateAge
had not been reachedDo I have that right? Could there be any negative consequences to this approach?
Best,
Luke
Beta Was this translation helpful? Give feedback.
All reactions