Skip to content

feat(auth): list custom OAuth/OIDC providers as an admin - #599

Merged
Tr00d merged 2 commits into
masterfrom
feat/auth.admin.list_providers
Oct 29, 2026
Merged

Tr00d merged 2 commits into
masterfrom
feat/auth.admin.list_providers

Conversation

@Tr00d

@Tr00d Tr00d commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Admins can list the custom OAuth/OIDC providers registered on the project, optionally only those of one type.

Capability: auth.admin.list_providers: Admin List Providers.

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<IReadOnlyList<CustomProvider>> ListCustomProvidersAsync(CustomProviderType? type = null, CancellationToken cancellationToken = default);
using Supabase.Gotrue.Common;

var admin = new AdminClient(serviceRoleKey, new ClientOptions { Url = authUrl });
var oidcProviders = await admin.ListCustomProvidersAsync(CustomProviderType.Oidc);

New types: none. It uses CustomProvider and CustomProviderType from #590. IGotrueApi<TUser, TSession> gains the matching ListCustomProvidersAsync(string jwt, CustomProviderType?, CancellationToken).

Behavior

Operation GET /admin/custom-providers with the service-role key. Adds ?type=oauth2 or ?type=oidc when type is given; sends no query when it is null.
Input type, optional. The enum makes the server's 400 for an invalid type impossible to reach.
Output 200 {"providers":[…]} → read-only list in server order. A null or absent providers, or a null body, gives an empty list.
Failures GotrueException: Reason = AdminTokenRequired on 401/403; ErrorCode = feature_disabled on 404 when custom providers are disabled
State None

Deviations from supabase-js

  • An enum instead of the 'oauth2' | 'oidc' string union.
  • Failures throw. supabase-js returns an empty list together with the error.

Tests

Tier Class Pins
E2E ListCustomProvidersTests A seeded OAuth2 provider is listed with no filter and with OAuth2, and left out with Oidc. Non-admin key → AdminTokenRequired.
Contract ListCustomProvidersContractTests Route and credentials, and no type query when unfiltered. type query for each enum value. Every listed provider mapped. Null, absent or missing providers → empty list. A cancelled token sends nothing. The call completes when the caller blocks on a context that never runs continuations.

Changed-line coverage: 100% (8 lines, measured against master). Mutation: 5/5 killed on changed lines, 0 survivors (3 compile errors, 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

packages/Gotrue/Gotrue/ListCustomProviders/
  CustomProviderListResponse.cs   internal: the {"providers": [...]} wire DTO and its mapping
  ListCustomProvidersQuery.cs     internal: the ?type= filter
packages/Gotrue/Gotrue.Tests/ListCustomProviders/

@Tr00d
Tr00d force-pushed the feat/auth.admin.list_providers branch from 780687f to a151cb7 Compare October 29, 2026 15:18
@Tr00d
Tr00d marked this pull request as ready for review October 29, 2026 15:24
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.
@Tr00d
Tr00d merged commit 2a9534d into master Oct 29, 2026
3 checks passed
@Tr00d
Tr00d deleted the feat/auth.admin.list_providers branch October 29, 2026 15:53
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