feat(clerk-js,ui,shared): route <ConfigureSSO /> through org-scoped enterprise_connections#8671
Conversation
…anization resource
- Add 6 methods on Organization.ts hitting /organizations/{id}/enterprise_connections/*
- Add new param types CreateOrganizationEnterpriseConnectionParams + Update variant; deprecate Me* aliases
- Re-route shared types to canonical Organization* names
- Extract toEnterpriseConnectionBody helper into utils/enterpriseConnection; used by User and Organization
- Add Organization.test.ts coverage mirroring User.test.ts patterns
User.ts methods + /me/* paths kept untouched (deprecated server-side but wired).
…ions - Add __internal_useOrganizationEnterpriseConnections + test-runs hook in @clerk/shared/react - Swap all user.*EnterpriseConnection* call sites in <ConfigureSSO /> to organization.* - Preserve useReverification wrapping - Update tests + fixtures to reflect the new call surface ORGS-1597 — backend org-scoped paths (clerk_go#19109) ship the canonical surface; this routes the SDK consumer to them.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 4e08a7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
| '@clerk/shared': minor | ||
| --- | ||
|
|
||
| `<ConfigureSSO />` now calls the org-scoped enterprise connections endpoints via `organization.*EnterpriseConnection*` methods. Previously, the wizard called `user.*EnterpriseConnection*` against the `/me/*` paths. |
There was a problem hiding this comment.
| `<ConfigureSSO />` now calls the org-scoped enterprise connections endpoints via `organization.*EnterpriseConnection*` methods. Previously, the wizard called `user.*EnterpriseConnection*` against the `/me/*` paths. | |
| Internal `<ConfigureSSO />` refactor to call new org-scoped enterprise connections FAPI endpoints, replacing the `/me/` deprecated scope |
Changing the copy a bit here to denote that this is an internal change, not important for external consumers
| --- | ||
| '@clerk/clerk-js': minor | ||
| '@clerk/shared': minor | ||
| --- | ||
|
|
||
| Add organization-scoped enterprise connection methods on the `Organization` resource: `getEnterpriseConnections`, `createEnterpriseConnection`, `updateEnterpriseConnection`, `deleteEnterpriseConnection`, `createEnterpriseConnectionTestRun`, and `getEnterpriseConnectionTestRuns`. These hit `/v1/organizations/{org_id}/enterprise_connections/*` and share the same flattened SAML/OIDC request body shape as the existing `User.*` equivalents. | ||
|
|
||
| Renames the parameter types from `Me*` to `Organization*`: | ||
| - `CreateOrganizationEnterpriseConnectionParams` | ||
| - `UpdateOrganizationEnterpriseConnectionParams` | ||
| - `OrganizationEnterpriseConnectionProvider` | ||
| - `OrganizationEnterpriseConnectionSamlInput` | ||
| - `OrganizationEnterpriseConnectionOidcInput` | ||
|
|
||
| The previous `Me*` names remain available as `@deprecated` aliases for backwards compatibility. |
There was a problem hiding this comment.
I think we can keep all on the same changeset, as those endpoints aren't public on the frontend API as well, it's not like developers were relying on the clerk-js resources for it
| // Currently FAPI only supports one enterprise connection per user | ||
| const enterpriseConnection = enterpriseConnections?.[0]; |
There was a problem hiding this comment.
Let's rename this comment now to:
// Currently the self-serve SSO UI flow only supports one enterprise connection per organization
Or feel free to adjust as well, FAPI currently returns a list, and we might expand in the future to support multiple connections on the UI.
| '@clerk/shared': minor | ||
| --- | ||
|
|
||
| `<ConfigureSSO />` now calls the org-scoped enterprise connections endpoints via `organization.*EnterpriseConnection*` methods. Previously, the wizard called `user.*EnterpriseConnection*` against the `/me/*` paths. |
There was a problem hiding this comment.
Also let's use the automatic generated snapshot naming with pnpm run changeset
Description
Backend clerk_go#19109 (merged) promoted the per-org enterprise_connections surface to
/v1/organizations/{org_id}/enterprise_connections/*. The/v1/me/enterprise_connections/*paths stay wired but are markeddeprecated: truein OpenAPI.This PR routes the JS SDK consumers through the canonical org-scoped paths.
What changed
@clerk/clerk-jsgetEnterpriseConnections,createEnterpriseConnection,updateEnterpriseConnection,deleteEnterpriseConnection,createEnterpriseConnectionTestRun,getEnterpriseConnectionTestRunson theOrganizationresource. Paths hit/v1/organizations/{org_id}/enterprise_connections/*;organization_idis omitted from the request body since the URL path is authoritative.User.tsintosrc/utils/enterpriseConnection.ts(toEnterpriseConnectionBody) and reused it from bothUser.tsandOrganization.tsso the two surfaces can never drift.User.tsmethods + their/me/*calls are unchanged.@clerk/sharedMeprefix (CreateOrganizationEnterpriseConnectionParams,UpdateOrganizationEnterpriseConnectionParams, provider/SAML/OIDC inputs). The oldMe*names are kept as@deprecatedaliases for backwards compatibility.OrganizationResourcemethod signatures for the six new methods.@clerk/shared/react:__internal_useOrganizationEnterpriseConnectionsand__internal_useOrganizationEnterpriseConnectionTestRuns. They mirror the existing user-scoped hooks but resolve the active organization viauseOrganization().@clerk/ui<ConfigureSSO />now consumes the org-scoped hooks. The provider passesorganization.*methods down through context, so the step components (ConfigureStep,ConfirmationStep,TestConfigurationStep,SelectProviderStep) consume the new surface without per-step rewires.useReverificationwrapping is preserved on every sensitive mutation.TestConfigurationSteppreviously calleduser.*directly for test-run reads/writes; it now usesuseOrganization()to reach the same methods onorganization.What stays the same
user.*EnterpriseConnection*methods and their/v1/me/enterprise_connections/*paths are untouched. External SDK consumers that already use them continue to work; backend keeps the deprecated paths wired.organization.*EnterpriseConnection*methods. The type namesCreateMeEnterpriseConnectionParamsetc. are now `@deprecated` aliases.Test plan
Linear
ORGS-1597
Out of scope
Checklist
Type of change