Support private_key_jwt client authentication for custom OIDC providers
#50814
Unanswered
axelv
asked this question in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Custom OIDC providers (
POST /admin/custom-providers) can only authenticate to the provider's token endpoint with aclient_secret(client_secret_basic/client_secret_post). There is no way to useprivate_key_jwt(RFC 7523, OIDC Core §9).Many regulated IdPs only accept asymmetric client authentication: healthcare and government identity providers, and anything following FAPI 2.0, which does not allow shared secrets. For those IdPs, the custom provider feature cannot be used at all.
Reproduction
Tested against
supabase/gotrue:v2.196.0, with a mock OIDC provider whose token endpoint only acceptsprivate_key_jwt:token_endpoint_auth_methods_supported: ["private_key_jwt"], but that field is not kept in the storeddiscovery_document, and the admin API has no parameter to set the auth method./callback, GoTrue sendsclient_secret_basic, then retries withclient_secret_post. It never sendsclient_assertion.A reference client using
private_key_jwtagainst the same mock gets an ID token, so the mock itself works. The only external-side code path isoauth2.Config.Exchangeininternal/api/provider/custom_oauth.go, which only sends the client secret.master(v2.198.0-rc.21) has noclient_assertionhandling for external providers either.Proposal
Add a
token_endpoint_auth_methodto custom providers (client_secret_basic|client_secret_post|private_key_jwt). Forprivate_key_jwt:client_secret) plus an optionalkid.client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearerand aclient_assertionJWT:iss=sub=client_id,aud= token endpoint, shortexp, uniquejti.This is additive. Existing providers keep the default
client_secret_basic.Workaround
Handle the OIDC login outside GoTrue, then create the GoTrue session through the admin API. That works, but it gives up the custom provider feature (claims allowlist, identity linking) for exactly the IdPs where it would help most.
The mock provider and a compose file that reproduces this are available if useful.
All reactions