sessions icon indicating copy to clipboard operation
sessions copied to clipboard

Automatic renewal for sessions

Open canidam opened this issue 1 year ago • 0 comments

Is there an existing feature request for this?

  • [X] I have searched the existing feature requests

Is your feature request related to a problem? Please describe.

I've a web app protected by a login system. Clients log in, and I keep their status / identity in a session cookie.

Today the maxAge is set to 30 days by default, allowing the user to update CookieStore with MaxAge method. This means users will have to re-login a system after 30 days, even if they browse the site daily.

Describe the solution that you would like.

Add a "automatic cookie renewal" functionality to allow the library renew cookies that are about to expire.

For example, a cookie is created with max age of 30 days. If the server sees a cookie that is about to expire in ~3-4 days, it renews itself by simply copying the session data to a new cookie with an updated maxAge of 30 days.

In scenarios where a user is not active for 30 days, and the cookie expires, they will need to re-login the system.

Describe alternatives you have considered.

Implementing this login in a middleware, but it is easier to do in the store itself.

Anything else?

No response

canidam avatar Jul 26 '24 17:07 canidam