How to stop session expire time prolongation?
Unanswered
Great golden digger wasp posted this in #help-forum
Great golden digger waspOP
Hi, I am using CredentialsProvider and I've my external JWT coming in that I wanna sync my expiration time with but I am unable to do that now because my session is automatically incrementing it's own expire time in every render. What could be the way to stop this behavior so that it doesn't auto increment and keeps a constant expire time?
5 Replies
Toyger
https://next-auth.js.org/configuration/options#session
both session and jwt have maxAge, you can set both to same value and it will not renew it.
both session and jwt have maxAge, you can set both to same value and it will not renew it.
@Toyger https://next-auth.js.org/configuration/options#session
both session and jwt have maxAge, you can set both to same value and it will not renew it.
Great golden digger waspOP
I've set both session and jwt to have maxAge of 10 (seconds) but it still increments if I refresh or re-render. I was looking for a solution to stop this behavior.
@Great golden digger wasp I've set both session and jwt to have maxAge of 10 (seconds) but it still increments if I refresh or re-render. I was looking for a solution to stop this behavior.
Toyger
then it's some other thing that renew it, because default behaviour is session expiration.
@Toyger then it's some other thing that renew it, because default behaviour is session expiration.
Great golden digger waspOP
Well if I stay idle the session does expire but if I keep re-rendering my application then in each render the session expire time increments. This looks to be the default behavior and I would like to make it stop.
@Great golden digger wasp Well if I stay idle the session does expire but if I keep re-rendering my application then in each render the session expire time increments. This looks to be the default behavior and I would like to make it stop.
Toyger
Oh wait I confused this, yeah it repopulates, but it's logical for example you put it to 2 hours, user works fine 10 min then return in 1h49m and he left with 1m of session thatvwill be dropped anyway which is bad UX. So you set it to enough idle time that you want be enough for user to end session if site not used. For example if user didn't use site for an hour we kill session.