Skip to content

Expired or invalid JWT gets error_description "No token validation method configured" #262

Closed

Description

@mcollina

When JWKS validation is configured and the token is expired or its signature is bad, TokenValidator.validateToken (src/auth/token-validator.ts) swallows the JWT error. Without an introspection endpoint it falls through to the generic message, so the challenge reads:

WWW-Authenticate: Bearer ..., error="invalid_token", error_description="No token validation method configured"

That is misleading for both clients and operators: a validation method is configured, the token just failed it.

Repro

Configure tokenValidation.jwksUri, send createExpiredJWT() from the test utils → 401 with the description above.

Suggested fix

Keep the JWT failure reason (e.g. "Token expired", "Invalid token signature", sanitized) and only use "No token validation method configured" when neither JWKS nor introspection is set.

Found during the round-7 review of #170; also on main.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions