Skip to content

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

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

Tr00d merged 2 commits into
feat/auth.admin.get_providerfrom
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.

Stacked on #591 (auth.admin.get_provider), which is stacked on #590 (auth.admin.create_provider). This PR's base is feat/auth.admin.get_provider, so the diff shows only the list capability. Retarget it once the PRs below it merge.

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 on top of #591). Mutation: 5/5 killed on changed lines, 0 survivors (3 compile errors, 1 ignored).

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.get_provider branch 2 times, most recently from a3bd552 to 69623fe Compare October 29, 2026 14:21
@Tr00d
Tr00d force-pushed the feat/auth.admin.list_providers branch from 4061731 to 796f94f Compare October 29, 2026 14:23
@Tr00d
Tr00d force-pushed the feat/auth.admin.get_provider branch from 69623fe to fa5b60f Compare October 29, 2026 14:28
@Tr00d
Tr00d force-pushed the feat/auth.admin.list_providers branch from 796f94f to 071053b Compare October 29, 2026 14:28
@Tr00d
Tr00d marked this pull request as ready for review October 29, 2026 15:00
@Tr00d
Tr00d merged commit d573951 into feat/auth.admin.get_provider Oct 29, 2026
@Tr00d
Tr00d deleted the feat/auth.admin.list_providers branch October 29, 2026 15:00
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