Bearer token from the Authorization header, verify it using the configured secret or public key, and attach the decoded payload to the request context. On failure they return a JSON error response and short-circuit the request.
Configuration Types
ValidateAccessTokenConfig
Used by the framework-specific middleware functions (validateAccessToken, honoValidateAccessToken, fastifyValidateAccessToken).
ValidatorConfig
Used by the standalonevalidateKey0Token function. Supports both HS256 and RS256.
AccessTokenPayload
All middleware functions resolve to the same decoded JWT payload shape.Framework Middleware
- Express
- Hono
- Fastify
- Standalone
validateAccessToken
Express middleware. On success, attaches the decoded payload toreq.key0Token.req.key0Token (AccessTokenPayload)Internal: validateToken
The framework-agnostic function used byvalidateAccessToken, honoValidateAccessToken, and fastifyValidateAccessToken. You do not need to call this directly unless you are building a custom integration.
Key0Error with the following codes:
Error Responses
All framework middleware functions return a consistent JSON error body on failure: 401 — Missing, expired, or invalid token:Related
Express Integration
Full setup guide for mounting Key0 routes and middleware in Express.
Backend Integration Example
Use validateKey0Token in a separate backend service.
AccessTokenIssuer
The JWT issuer whose tokens this middleware validates.

