Authentication
A short stateless access token signed with RS256: auth signs with the private key and any service verifies with the public key, without calling auth. A rotating refresh token stored only as a hash. Authentication scales with everything else.
Decisions and why
- RS256, asymmetric key
- Only auth holds the private key. Other services get the public key (or JWKS) and verify on their own: compromising one service does not let anyone mint tokens.
- 15-minute access token
- Short enough for a revocation to take effect quickly, and verifiable locally by any service.
- Refresh in an HttpOnly cookie per app, 3 days
- JavaScript cannot read the cookie, so XSS cannot steal the session. One cookie per app isolates the four front-ends.
- Rotation with reuse detection
- Every refresh swaps the token. If an old one shows up again, someone copied it: every session of that user is revoked.
- Only the hash in the database
- A database leak hands out no usable token.
- MFA and invitation-based accounts
- A 5-minute TOTP challenge and a 30-day trusted device; nobody picks another person's password.
requestresponse
Pick a scenario above to watch the message travel through the architecture.