Skip to content

[BUG] OIDC login fails when IdP JWKS contains keys with non-standard use #446

Closed

Description

@d0mitoridesu

What happened

After upgrading from 7.22.x to 7.23.0 (no config changes), every browser login fails on the OIDC callback with KeyParameterError: 'use' must be one of ['sig', 'enc']. Bearer-token API access keeps working.

Our IdP (Zitadel) publishes its SAML keys in the OIDC JWKS (/oauth/v2/keys) next to the signing keys, with use set to saml_ca, saml_response_sig and saml_metadata_sig.

7.23.0 requires authlib>=1.8. Since 1.7, authlib’s AsyncOpenIDMixin.parse_id_token(), which authorize_access_token() calls in routers/auth.py, loads the whole JWKS with joserfc.jwk.KeySet.import_key_set(). joserfc rejects any use outside sig/enc, so one such key fails the entire set.

The id_token is signed with a valid sig key, but verification never reaches it. authlib 1.6.x used authlib.jose.JsonWebKey.import_key_set, which tolerates these keys.

RFC 7517 §4.2 allows other use values (“Other values MAY be used”). joserfc already relaxed the analogous unknown-kty case (authlib/joserfc#103, #104). The same code path is still present in 9.0.3.

What you expected

Login succeeds

Reproduction

Steps, or a minimal configuration that triggers it.

1. Use an IdP whose JWKS contains a key with use other than sig/enc, e.g.:  saml_ca, saml_response_sig, etc
2. Log in through the UI: the callback fails.

Environment

  • mlflow-oidc-auth version: 7.23.0 (worked on 7.22.x with authlib 1.6.x)
  • MLflow version: 3.16.0
  • Python version: 3.13
  • Database (SQLite / PostgreSQL / MySQL): PostgreSQL
  • Identity provider (Keycloak / Entra ID / Okta / other): Zitadel
  • Deployment (single replica / multi-replica, behind a proxy?): single replica / multi-replica

Logs

Relevant log output. Redact tokens, secrets, and full JWTs — a JWT payload is base64, not
encryption.

WARNING:  OIDC token exchange failed: key_parameter: 'use' must be one of ['sig', 'enc']
ERROR:    OIDC token exchange error (joserfc.errors.KeyParameterError): key_parameter: 'use' must be one of ['sig', 'enc']
ERROR:    OIDC callback errors: ['Failed to process authentication response']

Activity

  1. kharkevich commented on Oct 6, 2026

    @kharkevich
    Member

    Thanks for the detailed report — confirmed and reproduced.

    joserfc's KeySet.import_key_set only skips keys with an unknown kty; any other unsupported value (here a use outside sig/enc, which RFC 7517 §4.2 explicitly allows) fails the whole set, and authlib's parse_id_token imports the whole set. Bearer tokens kept working because that path imports only the kid-named key.

    Fix in #447: the OIDC client now drops JWKs that can't be imported on their own (per RFC 7517 §5) before authlib verifies the id_token, so your signing key is used and the SAML keys are ignored. No key is accepted that wasn't already acceptable, and a set with no usable key still fails closed.

  2. added a commit that references this issue on Nov 10, 2026
    7107281
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions