Skip to content

feat(mosaic): sign up with enterprise SSO - #11022

Draft
austincalvelage wants to merge 6 commits into
austin/mosaic-sign-up-oauthfrom
austin/mosaic-sign-up-enterprise-sso
Draft

austincalvelage wants to merge 6 commits into
austin/mosaic-sign-up-oauthfrom
austin/mosaic-sign-up-enterprise-sso

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description

Adds enterprise SSO to Mosaic <SignUp />, with one connection or several. Stacked on #10945.

An email whose domain belongs to an enterprise connection used to end on Start over. Sign-up now sends the browser to the identity provider, as the legacy SignUp does, and finishes through the OAuth return that #10945 added. When the domain has several connections, sign-up shows a chooser first.

Shared changes (for Mosaic reviewers)

  • The test fake for sign-up now starts the enterprise strategy, returns the several-connections error when seeded with more than one connection, and clears enterprise_sso on the return.
  • It serves the connection list, can fail it with feature_not_enabled, and starts with a chosen connection id.
  • It keeps a completed sign-up on the client after a return, which handleRedirectCallback expects. It used to clear it. The social tests still pass.
  • It marks the email verified after an enterprise return. FAPI does the same: in the browser run the email came back verified by the saml strategy.
  • docs/internals/sign-in-sign-up-flow.md describes both paths under "Entry actions".

1. The redirect starts from the form's own submit, and the form holds while it does.

  • On the start and continue forms. The form stays shown with Continue busy while the redirect starts. The redirect uses the sign-up that already exists, so the email is kept.
  • If the browser is still on the page after REDIRECT_HOLD_MS. The form is usable again, for example after Back from the provider. Pressing Continue starts the redirect again.
  • If the redirect cannot start. The reason shows in the form's error banner.
  • sign-up-details.controller.ts starts the redirect inside the form's own submit, then holds, the way selectOAuth does for a social button.
  • sign-up.routes.ts lets continue stay shown while the step is enterprise_sso, so the continue form can hold. start already stayed shown for every step.

2. With no form to hold, the enterpriseConnections route starts the redirect.

  • With no form to hold. An invitation ticket, an OAuth return, or a code or Protect step can also lead to the enterprise_sso step. Those show the loading screen and start the redirect when the enterpriseConnections route opens. Start over appears if the start fails or the browser is still on the page after the hold.
  • sign-up.controller.ts starts it from the existing entry-action effect when the shown route is enterpriseConnections, next to the ticket and OAuth-return entries.

3. A domain with several connections gets a chooser.

  • The chooser. Sign-up tries the redirect first. If FAPI answers enterprise_connection_id_is_required_with_multiple_connections, sign-up lists the connections and shows "Choose an account" on the enterpriseConnections route, with the existing AuthEnterpriseConnections block.
  • Picking a connection. The redirect starts with that connection's id. Its button is busy and the other buttons are disabled. If the browser is still on the page after the hold, the chooser is usable again. A failed start shows its reason on the chooser.
  • Back. Returns to the start form with the email kept and the password cleared. The legacy chooser has no way back. Sign-up needs one because virtual routing has no browser Back.
  • A list that fails or comes back empty. The reason shows on the form, or on Start over when no form is behind it.
  • sign-up.model.ts adds flow.startEnterpriseSso(connectionId?). It calls sso({ strategy: 'enterprise_sso' }) with the callback URL the social flow uses, and does not reset the sign-up. On the several-connections error it lists the connections and resolves with { type: 'enterprise_connections' }, the way create resolves with blocked.
  • sign-up.controller.ts keeps that list for the mount and shows the chooser when it has one. No route rule changed for the chooser.
// sign-up.controller.ts
onSelectConnection: (id: string) =>
  void connectionActions.run(id, async () => {
    await flow.startEnterpriseSso(id);
    await new Promise(resolve => setTimeout(resolve, REDIRECT_HOLD_MS));
  }),

FAPI asks for a connection id only when the instance flag allow_multiple_enterprise_domains is on. Without the flag, a domain has one connection and this path does not run.

Known gaps

  • The connection list comes from __experimental_getEnterpriseConnections on the legacy sign-up resource. SignUpFuture has no method to list connections. Adding one is a separate clerk-js change.
  • Back on the chooser returns to the start form, also when the chooser was reached from the continue form.
  • A connection without a logo gets an empty image address. How that renders is not checked.
  • A sign-up that opens on continue with the step already enterprise_sso shows the continue form, and the redirect starts when the user presses Continue.
  • SSO that starts on sign-in for a new user is not covered, because Mosaic sign-in has no model or controller yet.
  • oidcPrompt is not supported, because it would add a prop to SignUp.
  • The error for a start that returns no redirect URL has no test.
  • A password typed on the start form stays on the user that SSO creates. This was seen in the browser run. What the legacy SignUp leaves on the user is not checked.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Dec 2, 2026 5:56pm UTC
mosaic-docs Ready Ready Preview Dec 2, 2026 5:56pm UTC
swingset Ready Ready Preview Dec 2, 2026 5:56pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f2905fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@11022

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@11022

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@11022

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@11022

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@11022

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@11022

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@11022

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@11022

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@11022

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@11022

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@11022

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@11022

@clerk/express

npm i https://pkg.pr.new/@clerk/express@11022

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@11022

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@11022

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@11022

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@11022

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@11022

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@11022

@clerk/react

npm i https://pkg.pr.new/@clerk/react@11022

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@11022

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@11022

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@11022

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@11022

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@11022

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@11022

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@11022

commit: 460dbeb

@austincalvelage austincalvelage changed the title feat(mosaic): start enterprise SSO from sign-up feat(mosaic): sign up with enterprise SSO Nov 26, 2026
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 40f72ce to 8d34792 Compare November 26, 2026 08:07
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 8d34792 to c83ab33 Compare November 30, 2026 07:00
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from c83ab33 to 1dfd5f5 Compare November 30, 2026 20:29
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 1dfd5f5 to 7ea1f73 Compare November 30, 2026 20:32
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 9ddadb1 to 89ecf89 Compare December 2, 2026 06:29
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 89ecf89 to 74cce81 Compare December 2, 2026 06:52
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 74cce81 to 460dbeb Compare December 2, 2026 07:33
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from 460dbeb to a7606ac Compare December 2, 2026 17:00
@austincalvelage
austincalvelage force-pushed the austin/mosaic-sign-up-enterprise-sso branch from a7606ac to 0fe8324 Compare December 2, 2026 17:30
An email whose domain belongs to an enterprise connection used to end on Start over. Sign-up now sends the browser to the identity provider from the sign-up it already has, so the email is kept, and finishes through the existing OAuth return.

The start and continue forms stay shown with Continue busy while the redirect starts. If the browser is still on the page after the hold, the form is usable again. A failed start shows its reason on the form. Entries with no form to hold, such as an invitation or a code screen, show the loading screen and start the redirect when the enterprise route opens.

Choosing between several connections is not built. That case shows FAPI's error.
…e SSO

A sign-up can need a Protect check and enterprise SSO at once. The first test asserts that the check runs before the redirect to the identity provider and that the redirect starts once. The second asserts that a check raised on the return runs, and that solving it finishes the sign-up.
An email domain can belong to more than one enterprise connection. Clerk then refuses to start the redirect without a connection id, and sign-up showed that error. Sign-up now lists the connections and shows the chooser on the enterprise route. Picking a connection starts the redirect with its id, with that button busy and the others disabled. Back returns to the form with the email kept.

The list comes from `__experimental_getEnterpriseConnections` on the legacy sign-up resource, because `SignUpFuture` has no method for it. A list that fails or comes back empty shows the reason on the form, or Start over when no form is behind it.

Clerk only asks for a connection id when the instance allows several connections on one domain, so sign-up with one connection is unchanged.
…the enterprise connections

Back on the enterprise connections screen returned to the form with the password still filled in, after it had already been sent. Edit on a verify screen clears it, and Back now does the same. The email address stays.
… raising timeouts

The enterprise SSO and enterprise connections tests waited out the redirect hold in real time and raised their waitFor timeout to 4 seconds to fit it. They now run on fake timers and advance past the hold.

Their seeded sign-ups no longer set missing_fields by hand. The fake FAPI derives enterprise_sso from the email domain.
…ion from the activity machine

Starting enterprise SSO is the activity machine's startingEnterpriseSso state, entered on a visit that opens on the enterprise route or by START_ENTERPRISE_SSO from next, once per mount. The connections to choose from live in the machine's context, set by CHOOSE_CONNECTION and cleared by CANCEL_CONNECTIONS. This replaces the enterpriseSso pending-action key, the lastKey check, the connections state and the effect that started the redirect. A failed start still shows its error on Start over.

This branch was successfully deployed

2 active deployments
Preview – swingset — f2905fb6 Deployed Dec 2, 2026 by vercel[bot]
Preview – clerk-js-sandbox — f2905fb6 Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant