fix(ui): redirect signed-in users forward from factor-two#7788
fix(ui): redirect signed-in users forward from factor-two#7788nikosdouvlis wants to merge 4 commits intomainfrom
Conversation
…ssion Why: Users navigating directly to /sign-in#/factor-two without an active sign-in requiring 2FA would see an infinite loading spinner because there was no status check to redirect them back to sign-in start. What changed: Added useEffect to SignInFactorTwo that redirects to sign-in start when signIn.status is null, needs_identifier, or needs_first_factor. Matches the existing pattern in SignInFactorOne. Key detail: dependency array only includes __internal_setActiveInProgress (not signIn.status) to avoid triggering redirect during valid sign-in completion when status changes to null.
Acronyms like 2FA, SSO, JWT in commit subjects trigger false positives with the strict case check.
When a signed-in user lands on factor-two without a pending 2FA (e.g. page reload after successful verification in a multi-session app), redirect to afterSignInUrl instead of back to sign-in start.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: b1bbe99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
📝 WalkthroughWalkthroughThis pull request introduces routing improvements and bug fixes for the factor-two sign-in flow in the 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@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: |
Summary
Follow-up to #7774. Builds on the infinite spinner fix by improving the redirect behavior for multi-session apps.
When a signed-in user lands on factor-two without a pending 2FA session (e.g. the dashboard reloads after successful verification), the previous fix redirected back to sign-in start which isn't ideal since the user is already authenticated.
This changes the behavior so that:
afterSignInUrlThis is experimental - we want to verify on the dashboard before deciding whether to keep it.
Test plan
/sign-in#/factor-twowhile signed in on a multi-session app - should redirect to afterSignInUrl/sign-in#/factor-twowhile signed out - should redirect to sign-in startSummary by CodeRabbit
Bug Fixes
Changes