Skip to content

feat(jwt,jwk): add realm option to customize WWW-Authenticate header#5005

Open
mixelburg wants to merge 1 commit into
honojs:mainfrom
mixelburg:fix/jwt-jwk-realm-option
Open

feat(jwt,jwk): add realm option to customize WWW-Authenticate header#5005
mixelburg wants to merge 1 commit into
honojs:mainfrom
mixelburg:fix/jwt-jwk-realm-option

Conversation

@mixelburg

Copy link
Copy Markdown
Contributor

Fixes #4989

The jwt and jwk middlewares previously hardcoded the request URL as the realm value in the WWW-Authenticate header. Per RFC 6750, realm should be a stable, human-readable string identifying the protection space — not the varying request URL.

This adds an optional realm option to both middlewares, matching the pattern already used by bearer-auth. When not set, the previous behavior (request URL) is preserved.

@mixelburg mixelburg force-pushed the fix/jwt-jwk-realm-option branch from e01cd9d to f70d512 Compare June 13, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jwt and jwk middlewares hardcode req.url as WWW-Authenticate realm with no configurable override, unlike bearer-auth

1 participant