createJwtSessionModule. There is no jwtSession() plugin, no theauth.jwt property, and no /auth/jwt/* routes. You call the module from your own handlers.
Setup
Usage
Every method returns aResult: { success: true, data } or { success: false, error: { code, message } }. They do not throw for normal failures.
Create a session
customClaims function in the config, which receives { id, email?, name? }. createSession does not take a claims argument.
Verify an access token
TOKEN_EXPIRED, INVALID_TOKEN, ISSUER_MISMATCH, AUDIENCE_MISMATCH).
Refresh
sub and your customClaims output, but not the email or name from the original createSession call. Errors are REFRESH_TOKEN_NOT_FOUND, REFRESH_TOKEN_USED, and REFRESH_TOKEN_EXPIRED. Presenting an already-used refresh token fails but does not revoke the user’s other refresh tokens.
Revoke
revokeSession marks one refresh token as used. Revoking an already-revoked or unknown token is a no-op. There is no revoke-all method on this module.
Algorithms
The module does not publish a JWKS endpoint. If other services verify your tokens with a public key, serve that key yourself.
HTTP endpoints
The module ships no HTTP handler. Expose the methods through routes you write, for examplePOST /auth/token calling createSession and POST /auth/refresh calling refreshSession.
Access tokens are stateless. Revocation only affects refresh tokens. For immediate access token invalidation, use short TTLs (5-15 minutes).
emitAgenticJwtClaims: true to add agent_id, agent_type, and trust_tier claims when createSession receives an agenticContext on the user. See Standards alignment.
Related
Sessions
Cookie sessions, JWT tokens, and the full session lifecycle.
Cookie options
Cookie attributes for same-domain browser setups.
MCP OAuth 2.1
OAuth 2.1 token issuance for MCP tool server authorization.
Standards alignment
IETF draft claims added to agent JWTs.