Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: session max age note #254

Closed

Conversation

patrick-hofmann
Copy link

I've added a note and example since it is not obvious that maxAge of the session is not the same as maxAge of the cookie

@atinux
Copy link
Owner

atinux commented Oct 24, 2024

Hi @patrick-hofmann

Actually we use maxAge to set the cookie expiration, see https://github.com/unjs/h3/blob/7324eeec854eecc37422074ef9f2aec8a5e4a816/src/utils/session.ts#L141

As the session is stored in the cookie, it expires at the same time the cookie expires.

@patrick-hofmann
Copy link
Author

Hi @atinux

you are right, indeed session and cookie lifetime are equal in the current example. Nevertheless this documentation PR also shows why I've created the two PRs

#255 - cookies shall live as short as possible and lifetime should extend while in usage (this could also be achived with a kind of session rotation)

and

#257 - the session lifetime shall end immediately when the user is logged out.

Best regards!

@atinux atinux closed this Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants