intermediateAuthentication with JWT

Why is a JWT-based API typically configured as stateless, and what does that change?

A JWT carries the user's identity and claims signed inside the token itself, so the server doesn't need to keep a session store to know who's making a request — it just verifies the signature on each call. This means `SessionCreationPolicy.STATELESS` is set in the security config, load balancing becomes trivial (any server instance can validate any token), but it also means there's no server-side session to instantly invalidate on logout.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What actually happens if you decode a JWT's payload without a library — is it 'safe' to just read?← Back to all Spring Boot questions