Stateless JWTs are great until someone needs to be locked out now. The usual answers - a session table, a revocation blocklist - hand back the database round-trip you adopted JWTs to avoid. Streetvers does it with one column.
Version the token, not the session
Every JWT carries a token_version claim. On decode, the API re-reads the account's current token_version and rejects any token whose value is stale. Deactivating an admin is a single UPDATE that bumps the counter - and every outstanding token for that account dies on its next request.
Revocation should cost one row write, not a lookup on every authenticated call.
Close the side doors too
Auth is only as strong as its quietest leak:
- Failed player lookups still run a dummy bcrypt, so a wrong username takes the same time as a wrong password - no user-enumeration via timing.
/auth/tokenand/auth/registerare capped per-IP, so the login surface can't be ground down by brute force.- The whole scheme is written down as numbered ADRs, so the next person (or me, in six months) knows why, not just what.