Endpoint
Request Body
The JWT access token to verify. This is typically extracted from the Authorization header or cookies.
The anti-CSRF token to validate (required if anti-CSRF is enabled and
doAntiCsrfCheck is true).Whether to perform anti-CSRF token validation. Set to
true for state-modifying requests (POST, PUT, DELETE).Whether anti-CSRF protection is enabled for this session. Must match the value used during session creation.
Whether to check if the session exists in the database. Enables token blacklisting at the cost of a database query.
true- Verify session exists in database (enables immediate revocation)false- Trust the JWT signature only (better performance)
access_token_blacklisting config setting.Response
Success Response
Returns
"OK" on successful verification.Session metadata
New access token (only if token was rotated)
Error Responses
Error status code:
"UNAUTHORISED"- Invalid token or session not found"TRY_REFRESH_TOKEN"- Access token expired, client should refresh
Error description explaining why verification failed.
Example Request
Example Response
Successful Verification
Unauthorized Response
Try Refresh Token Response
Implementation Details
Source Code Reference
Implemented in:- API Handler: View source
- Session Logic: View source
Verification Process
- Parse and Verify JWT - Validates signature, expiry, and structure
- Extract Tenant Information - Derives tenant ID from access token
- Anti-CSRF Check - Validates anti-CSRF token if enabled
- Database Check - Optionally verifies session exists and is not revoked
- Token Rotation - Issues new access token if refresh token was rotated
- Return Session Data - Provides session information and optional new token
Token Rotation
A new access token is issued if:- The refresh token associated with this access token has been rotated
- The JWT payload in the database differs from the token payload
- The
parentRefreshTokenHash1in the token doesn’t match current state
Security Considerations
Anti-CSRF Protection
Anti-CSRF checks should be:- Enabled (
doAntiCsrfCheck: true) for state-modifying requests - Disabled (
doAntiCsrfCheck: false) for read-only requests (GET) to reduce overhead
Database Checking
Database checking tradeoffs: Enabled (checkDatabase: true):
- ✓ Sessions can be revoked immediately
- ✓ Detects stolen or blacklisted tokens
- ✗ Adds database query latency to each request
- ✗ Increases database load
checkDatabase: false):
- ✓ Better performance (no database query)
- ✓ Lower database load
- ✗ Revoked sessions remain valid until token expiry
- ✗ Cannot detect blacklisted tokens
Token Theft Detection
If verification returnsTRY_REFRESH_TOKEN, the client should:
- Call the refresh endpoint with the refresh token
- If refresh succeeds, update stored tokens and retry the request
- If refresh fails with
UNAUTHORISEDorTOKEN_THEFT_DETECTED, log out the user
Common Use Cases
API Request Authentication
Sensitive Operation Verification
Error Handling
Unauthorized Errors
Common causes:- Access token has expired
- Session was revoked
- Token signature is invalid
- Anti-CSRF token doesn’t match
- Session not found in database (when
checkDatabase: true)
Try Refresh Token
Causes:- Access token expired but session still valid
- Anti-CSRF check failed
- Token signing key rotated
CDI Version Compatibility
- CDI < 2.21: Returns JWT signing public key in response
- CDI >= 2.21:
checkDatabaseparameter available, no signing key in response - CDI >= 3.0:
tenantIdincluded in session response - CDI >= 4.0:
recipeUserIdincluded in session response