You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Authorization server: refuse every failed private_key_jwt client assertion with 401 invalid_client #7028
When a private_key_jwt client assertion fails a check, the token endpoint answers with different errors depending on which check failed (v0.60.0):
a wrong aud or an unregistered key: 401 invalid_client;
an exp more than MaxAssertionLifespan ahead: 500 server_error. SetClientAssertionJWT returns a plain error (pkg/authserver/storage/memory.go, and the Redis equivalent), which surfaces as a server error;
a reused jti: 400 jti_known (fosite's ErrJTIKnown).
RFC 6749 §5.2 assigns invalid_client to every failed client authentication. Clients treat server_error as a retryable outage, so an assertion that will never be accepted looks like one that might be. jti_known is not a registered OAuth error code, so clients cannot classify it.
The accepted assertion audience is also broader than the issuer. clientAssertionAudienceConfig accepts the issuer or the token endpoint URL, and an aud array containing either (pkg/authserver/server/private_key_jwt_client_auth.go). #6946 said a later release would require the issuer as the only value. Once #7019 closes #6893, nothing tracks that change.
Mecatl's broker authenticates to the authorization server this way on every token request. Its design requires aud to be the issuer as the only value and requires a 401 invalid_client for every failed check (credentials-and-lifecycle.md, step 5).
Change
Every failed private_key_jwt check returns 401 invalid_client: wrong aud, unknown key, bad signature, expired, not yet valid, over-long lifetime, and reused jti. The error_description may say which check failed, but must not echo the assertion.
A storage failure while recording the jti (not a policy refusal) stays a 500 server_error.
Optionally, require the issuer as the assertion's only aud value, as Accept issuer as client assertion audience #6946 planned. This could be a configuration option, so existing clients can migrate.
Each of these assertions gets 401 invalid_client with no token issued: an expired assertion, one whose exp is beyond the maximum lifespan, one whose jti was used before, a wrong aud, and an unregistered key.
With the strict audience on, an assertion whose aud is the token endpoint URL, or an array with an extra value, gets 401 invalid_client.
Two cases from "private_key_jwt authentication failures return 500 or 400 instead of 401 invalid_client" (#6995), which I'm closing as a duplicate of this issue. Please add them to the acceptance:
I split the optional strict audience into #7039. It changes which assertions are accepted and needs a migration option, so it gets its own PR. #7036 covers the rest of this issue and will close it.
Activity
jhrozek commentedon Nov 3, 2026
Two cases from "private_key_jwt authentication failures return 500 or 400 instead of 401 invalid_client" (#6995), which I'm closing as a duplicate of this issue. Please add them to the acceptance:
kidthat is not in the client's key set gets 401invalid_client. private_key_jwt authentication failures return 500 or 400 instead of 401 invalid_client #6995 reported 400invalid_requestat v0.60.0, and the problem statement here says an unregistered key already gets 401, so one of the two is out of date. A test will settle it.iatis slightly in the future gets 401invalid_client. private_key_jwt authentication failures return 500 or 400 instead of 401 invalid_client #6995 reported 500error. The skew margin itself is "Authorization server: allow clock skew on private_key_jwt client assertions" (Authorization server: allow clock skew on private_key_jwt client assertions #6954).jhrozek commentedon Nov 3, 2026
Assigning to
@pcbeingused333 per #6995 (comment)
jhrozek commentedon Nov 3, 2026
For some reason I can't assign this to you @pcbeingused333 but feel free to send a PR
jhrozek commentedon Nov 3, 2026
I split the optional strict audience into #7039. It changes which assertions are accepted and needs a migration option, so it gets its own PR. #7036 covers the rest of this issue and will close it.