Skip to content

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

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

austincalvelage wants to merge 4 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.

What the user sees

  • 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.
  • 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.

With several connections on the domain

  • 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. 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.

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.

How it works

  • 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-details.controller.ts starts the redirect inside the form's own submit, then holds, the way selectOAuth does for a social button.
  • 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.
  • 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.
  • docs/internals/sign-in-sign-up-flow.md describes both paths under "Entry actions".

Fake FAPI

  • It 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.

Tested in a browser

Run in Chrome against a staging development instance with one active SAML connection. A local Keycloak was the identity provider, from the same image that the SSO integration tests use.

  • Email and password on the start form. The form stays shown with the fields locked and Continue busy. The same tab goes to the identity provider. The return ends signed in as the new user, with a SAML enterprise account.

  • The same email a second time. The return signs in to the account that already exists. The instance still has one user for that email.

  • Continue with Google, with a Google account on the connection's domain. After Google, FAPI still requires SSO. Sign-up goes on to the identity provider, and the return ends signed in. No Google account is linked to the user.

  • Two connections on one domain. With allow_multiple_enterprise_domains on for the instance, Continue shows the chooser with both connections. Back returns to the form with the email kept. Picking the second connection goes to its identity provider, and the return ends signed in with an enterprise account on that connection.

Not run in a browser: Back from the identity provider, a redirect that fails to start, a connection list that fails, and the continue form. The feature tests cover those.

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 Nov 26, 2026 8:08am UTC
mosaic-docs Ready Ready Preview Nov 26, 2026 8:08am UTC
swingset Ready Ready Preview Nov 26, 2026 8:08am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8d34792

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: 8d34792

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.

This branch was successfully deployed

2 active deployments
Preview – swingset — 8d347925 Deployed Nov 26, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 8d347925 Deployed Nov 26, 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