Skip to content

feat(auth): fetch a custom OAuth/OIDC provider as an admin - #591

Merged
Tr00d merged 4 commits into
masterfrom
feat/auth.admin.get_provider
Oct 29, 2026
Merged

Tr00d merged 4 commits into
masterfrom
feat/auth.admin.get_provider

Conversation

@Tr00d

@Tr00d Tr00d commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Admins can fetch a custom OAuth/OIDC provider by its identifier.

Capability: auth.admin.get_provider: Admin Get Provider.

Standalone: branches off master, which already has the shared CustomProvider types from #590. Its only overlap with the other custom-provider PRs is where each adds its member to Api, AdminClient, the two interfaces and PublicAPI.Unshipped.txt; whichever merges second rebases and keeps both sides.

Public API

// IGotrueAdminClient<TUser>
Task<CustomProvider> GetCustomProviderAsync(string identifier, CancellationToken cancellationToken = default);
var admin = new AdminClient(serviceRoleKey, new ClientOptions { Url = authUrl });
var provider = await admin.GetCustomProviderAsync("custom:mycompany");

New types: none. It returns the CustomProvider added in #590. IGotrueApi<TUser, TSession> gains the matching GetCustomProviderAsync(string jwt, string identifier, CancellationToken).

Behavior

Operation GET /admin/custom-providers/{identifier} with the service-role key
Input identifier, required, starting with custom:
Output 200 → CustomProvider. The return is never null: a missing provider throws.
Checks before the request ArgumentNullException for null. ArgumentException when the identifier lacks the case-sensitive custom: prefix or contains /, \, ?, # or %. This is the check delete uses.
Failures GotrueException: Reason = CustomProviderNotFound on 404 custom_provider_not_found; Reason = AdminTokenRequired on 401/403; ErrorCode = feature_disabled on 404 when custom providers are disabled. A null body also throws GotrueException.
State None

Deviations from supabase-js

supabase-js puts the identifier into the URL without encoding or validation. This SDK rejects identifiers that would change the route before sending anything, as DeleteCustomProviderAsync does.

Tests

Tier Class Pins
E2E GetCustomProviderTests A seeded provider is returned as registered. Unknown identifier → CustomProviderNotFound. Non-admin key → AdminTokenRequired.
Contract GetCustomProviderContractTests Route and service-role credentials. Response mapping. 404 → CustomProviderNotFound. null body. A cancelled token sends nothing. The call completes when the caller blocks on a context that never runs continuations.
Unit GetCustomProviderIdentifierTests Null, unprefixed and route-changing identifiers rejected before the request

Changed-line coverage: 100% (7 lines, measured against master). Mutation: 2/2 killed on changed lines, 0 survivors (1 ignored). The local mutation run predates the split; the production code is unchanged and the mutation check on this PR reruns it.

No wire-shape approval snapshot: the request has no body.

Layout

Get has no types of its own, so it has no production folder. It returns Supabase.Gotrue.Common.CustomProvider from #590. Tests: packages/Gotrue/Gotrue.Tests/GetCustomProvider/.

Notes

The custom-provider route is now built in one helper (CustomProviderUrl), shared with delete.

@Tr00d
Tr00d force-pushed the feat/auth.admin.create_provider branch from 5791cd9 to 2d4275e Compare October 29, 2026 14:09
@Tr00d
Tr00d force-pushed the feat/auth.admin.get_provider branch from 95f804a to a3bd552 Compare October 29, 2026 14:12
@Tr00d
Tr00d force-pushed the feat/auth.admin.create_provider branch from 2d4275e to df67450 Compare October 29, 2026 14:19
@Tr00d
Tr00d force-pushed the feat/auth.admin.get_provider branch from a3bd552 to 69623fe Compare October 29, 2026 14:21
@Tr00d
Tr00d force-pushed the feat/auth.admin.create_provider branch from df67450 to 627dbc6 Compare October 29, 2026 14:28
@Tr00d
Tr00d force-pushed the feat/auth.admin.get_provider branch from 69623fe to fa5b60f Compare October 29, 2026 14:28
Base automatically changed from feat/auth.admin.create_provider to master October 29, 2026 14:41
@Tr00d
Tr00d marked this pull request as ready for review October 29, 2026 15:00
@Tr00d
Tr00d force-pushed the feat/auth.admin.get_provider branch 2 times, most recently from 489bbfc to bd1ecd3 Compare October 29, 2026 15:11
@Tr00d
Tr00d force-pushed the feat/auth.admin.get_provider branch from bd1ecd3 to ca5a133 Compare October 29, 2026 15:18
Tr00d and others added 3 commits October 29, 2026 16:29
Drop the duplicated CreateCustomProviderAsync entry from PublicAPI.Unshipped.txt,
restore the generated sdk-compliance.yaml entry for update_provider, keep the
update member's doc comment intact, and remove a whitespace-only line.
@Tr00d
Tr00d merged commit f5cd18a into master Oct 29, 2026
3 checks passed
@Tr00d
Tr00d deleted the feat/auth.admin.get_provider branch October 29, 2026 15:45
Tr00d added a commit that referenced this pull request Oct 29, 2026
Rebuilt on master after #591: list's members sit after get's, its using
directives are added, and PublicAPI.Unshipped.txt is regenerated by the analyzer.
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.

1 participant