Repository navigation
feat: support client_auth_method on gotrue_custom_oauth_provider - #9
Merged
Merged
Conversation
Add client_auth_method ("client_secret" or "private_key_jwt") and
client_assertion_audience to the custom OAuth provider resource, matching
the custom provider admin API (supabase/auth#2935).
- client_secret is now optional. A CustomizeDiff check enforces the
server's rules at plan time: a secret is required for client_secret and
forbidden for private_key_jwt, private_key_jwt is OIDC-only, and an
audience is only allowed with private_key_jwt.
- The default method is not sent on create, and a missing method in
responses is read as client_secret, so older auth servers keep working.
- The audience is only sent for private_key_jwt providers. The server
clears it when switching to client_secret and rejects any audience
while client assertions are disabled.
|
@claude review |
fadymak
approved these changes
Nov 18, 2026
- When client_auth_method changes to client_secret, always send client_secret. The server never returns the secret, so state can still hold the configured value and show no change after the method was switched outside Terraform, which made the server reject the update. - Don't send client_auth_method when the old state has no value and the new one is the default. State from earlier provider versions has no method, and older servers may not know the field.
cemalkilic
added a commit
to supabase-community/pulumi-gotrue
that referenced
this pull request
Nov 18, 2026
## What Picks up the new custom provider admin API params from supabase/auth#2935, via supabase-community/terraform-provider-gotrue#9: - `clientAuthMethod`: `client_secret` (default) or `private_key_jwt` - `clientAssertionAudience`: overrides the `aud` claim of client assertions `clientSecret` is now optional. Schema and Go, Node.js, Python and .NET SDKs are regenerated. Only the `CustomOauthProvider` files changed. Bumps `terraform-provider-gotrue` to `v1.1.4`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds support for the new custom provider admin API params from supabase/auth#2935:
client_auth_method:client_secret(default) orprivate_key_jwtclient_assertion_audience: overrides theaudclaim of client assertions (max 2048 chars)client_secretis now optional.Behaviour
Plan-time validation (
CustomizeDiff) mirrors the server rules, so mistakes fail atplaninstead of as a 400 atapply:client_secretis required forclient_secretand must not be set forprivate_key_jwtprivate_key_jwtis only allowed foroidcprovidersclient_assertion_audienceis only allowed withprivate_key_jwtValues unknown until apply are left for the server to check.
Older auth servers keep working: the default method is not sent on create, and a response without
client_auth_methodis read asclient_secret.Audience is only sent for
private_key_jwtproviders. The server clears it on a switch toclient_secret, and rejects any audience (even"") while client assertions are disabled. Sending it would break switching back after the flag is turned off. Removing the audience on aprivate_key_jwtprovider sends"", which clears it.Tests
gotrue/custom_oauth_provider_test.gocovers each validation rule, the request bodies for create and update (switching methods both ways, changing and removing the audience), and reading from a server that doesn't return the method.Follow-up
supabase-community/pulumi-gotrue will be bumped to the tag cut from this PR.