Repository navigation
feat: add the force-enterprise-sso session task - #10206
Closed
gabrielmeloc22 wants to merge 4 commits into
Closed
gabrielmeloc22 wants to merge 4 commits into
gabrielmeloc22 wants to merge 4 commits into
Conversation
… session pending Switching organization with setActive, as the OrganizationSwitcher does, only learns the session became pending from ... setActive now navigates to the task (taskUrls, or the sign-in page's task route) when an organization switch leaves t...
Organizations can require members to authenticate through their enterprise SSO connection before using the organization, which the backend expresses as the setup-enterprise-sso session task. Clerk components had no step for it, so a pending session landed on an empty tasks route. The task step finds the active organization's SSO connection and starts the account linking flow through it, which also covers re-authenticating an already linked account.
With path routing, moving to the next session task built its URL with the current task page as redirect_url. Once the last task finished, the user was sent back to the previous task's page, which found no task and redirected to itself, leaving the sign-in spinner up forever. This shows up when setup-enterprise-sso follows choose-organization on a first sign-up. The next task's URL now carries the flow's destination (redirectUrlComplete) instead.
🦋 Changeset detectedLatest commit: 5a597bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-biometrics
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/mosaic
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
…prise-sso The task forces SSO on every activation of the organization rather than setting something up once, so the key, component and localization names now say that, matching the backend.
Contributor
Author
|
closing for now, we're restructuring this around the Consensus flow (no orgs). branch stays around |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Organizations can require members to authenticate through their enterprise SSO connection before using the organization. The backend expresses this as a new
force-enterprise-ssosession task (clerk/clerk_go#23030): when such an organization becomes active, at sign-in or on an organization switch, the session stays pending until the user goes through the connection. Clerk components didn't know this task, so users ended up on an empty tasks route or, after switching organization, with a pending session and nothing on screen.Changes:
force-enterprise-ssotask in<SignIn />and<SignUp />. It finds the active organization's SSO connection and starts the existing organization account linking flow (user.createExternalAccount({ enterpriseConnectionId, redirectUrl })). The same button covers the first link and re-authenticating an already linked account. When the user returns from the IdP with the task cleared, the tasks router moves on as usual.setActiveroutes to the task after an organization switch. The switch only becomes pending in the touch response, after the task URL was decided, so<OrganizationSwitcher />andsetActive({ organization })left the session pending without navigating. It now navigates totaskUrls[key], or the sign-in page's task route, unless anavigatecallback is passed.redirect_url. Whenforce-enterprise-ssofollowedchoose-organizationon a first sign-up, completing it sent the user back tochoose-organization, which redirected to itself and left the spinner up.Not included yet: a standalone
<TaskForceEnterpriseSSO />component, modal<SignIn />support for the IdP round trip, and showing an error when the SSO attempt fails.How to test: against a local backend running clerk/clerk_go#23030, enable the
force-enterprise-ssoinstance session task and organization account linking on a SAML connection attached to an organization. Sign in as a member, or switch into the organization, and complete SSO from the task screen.Checklist
pnpm testruns as expected. (Ran the clerk-jsclerk.test.tssuite and the uiSessionTaskstests, not the full suite.)pnpm buildruns as expected. (Ran the ui type-check and dev builds of clerk-js and ui.)Type of change