Skip to content

Conversation

@wbamberg
Copy link
Collaborator

@wbamberg wbamberg commented Jan 26, 2026

Here's a page on session management.

Terminology

I've talked mostly about two different models, one where the state is stored in the server and the client gets a session ID, and the other where the state is stored as a signed object (JWT) in the client. I've called these "centralized" and "decentralized" but people don't use these terms.

People sometimes use terms like "cookie-based" for the first and the second "JWT-based", but I don't like these, because ISTM that:

  1. how you store session information in the client and communicate it to the server is orthogonal to these architectural choices - that is, you don't have to do the first using cookies, and you could do the second using cookies

  2. (this is a much weaker objection) although in practice everyone does use JWTs for the second, that's an implementation choice not an architectural one.

I have asked about this and got feedback that my choice here is reasonable, but just flagging it here. We could call them "server-maintained state" and "client-maintained state" which is more descriptive but a real mouthful.

Frameworks and libraries

Regarding the section on "Frameworks and libraries", I do think we need to say this but went back and forth on whether to say it at the start or at the end, and how much detail to go into. FWIW although it might seem to negate the point of all this if we just tell people to use a framework, I really don't think it does - it is important to understand the principles and good practices, even if your framework is looking after a lot of the details for you.

@github-actions github-actions bot added Content:Security Security docs size/m [PR only] 51-500 LoC changed labels Jan 26, 2026

A website can also invalidate existing sessions and require reauthentication:

1. When the client attempts some high-risk operation, such as attempting to change, or actually changing, the user's credentials on the site, or triggering the account recovery (e.g. password reset) process.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mdn-linter] reported by reviewdog 🐶

Suggested change
1. When the client attempts some high-risk operation, such as attempting to change, or actually changing, the user's credentials on the site, or triggering the account recovery (e.g. password reset) process.
1. When the client attempts some high-risk operation, such as attempting to change, or actually changing, the user's credentials on the site, or triggering the account recovery (e.g., password reset) process.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

Preview URLs (1 page)

External URLs (3)

URL: /en-US/docs/Web/Security/Authentication/Session_management
Title: Session management

(comment last updated: 2026-01-28 04:17:59)

@wbamberg wbamberg marked this pull request as ready for review January 28, 2026 04:16
@wbamberg wbamberg requested a review from a team as a code owner January 28, 2026 04:16
@wbamberg wbamberg requested review from hamishwillee and removed request for a team January 28, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Security Security docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant