[@clerk/react v6] <SignIn> sends duplicate email_code on second-factor (MFA) step, distinct from #8463
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 50/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- authentication, frontend
Research direction
Start with the prebuilt @clerk/react flow and the transition from needs_second_factor after password success. Trace where prepareSecondFactor() is called and compare it with the backend-prepared verification shown in the dashboard events. Reproduce with password plus email_code MFA, then confirm that only an explicit Resend sends another code.
Written by the indexing model from the issue text.
Description
Reproduction
- Instance has password as first factor,
email_codeas the (only) required second factor / MFA strategy. - Render prebuilt
<SignIn routing="path" path="/sign-in" signUpUrl="/sign-up" />(no custom flow). - Submit correct password. First factor passes cleanly (no duplicate here).
- Sign-in transitions to
needs_second_factor. Twoemail_codeverification emails arrive ~1 second apart; the first code is invalidated by the second.
Dashboard log evidence (single sign_in_id, single client)
sign_in.attempt_first_factor.passed strategy=password (T+0.0s)
sign_in.email_address.verification_code_sent (T+0.0s) <- code #1
sign_in.prepare_second_factor.passed strategy=email_code, new verification_id (T+0.0s)
sign_in.email_address.verification_code_sent (T+1.0s) <- code #2, invalidates #1
Same sign_in_id, same client_id, same IP across all four events — this is one browser tab, one attempt, not a remount/refresh or a second tab.
Why this looks like a sibling of #8463, not a duplicate report
#8463 (closed, "fixed in Core 3") and #8684/#4324 are about prepareFirstFactor / SignUp.create() re-sending a code on remount or because create() already prepares under the hood before an explicit prepare call fires again.
This reproduces on @clerk/[email protected] (Core 3, current latest), with no remount involved — it's the transition from first-factor success straight into the second-factor (MFA) step, in a single mount. It looks like the same class of bug (backend/widget both send a code for the same verification step) but on the prepareSecondFactor code path specifically, which doesn't appear to have been covered by the Core 3 fix for the first-factor case.
Expected behavior
When a sign-in transitions to needs_second_factor and email_code is the strategy, <SignIn> should resume on whatever verification the backend already prepared for that transition (if any) rather than unconditionally calling prepareSecondFactor() again. A second code should only be sent when the user explicitly clicks "Resend."
Environment
@clerk/react:6.12.9- React: 19, Vite 6
pk_test_*instance, password + email_code (as second factor/MFA) enabled- Reproduces in Chrome (desktop), consistently, every sign-in attempt requiring the second factor
Related
- #8463 (first-factor/remount case, closed as fixed in Core 3 — this is a different code path)
- #8684, #4324 (SignUp / prepareFirstFactor variants of the same "double prepare" pattern)
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 479
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 313
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from clerk/javascript
-
signIn.sso() ignores oidcPrompt for OAuth strategiesPossibly taken @wobsoriano claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
clerk/javascript#10119 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
clerk/javascript#10026 · 1 comment ·
Maintainers usually reply within 1 day
-
@clerk/nextjs: onBeforeSetActive never settles when invalidateCacheAction rejects (e.g. after a redeploy), so setActive and signOut hang foreverPossibly taken @RaphaelFakhri claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
clerk/javascript#9987 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
clerk/javascript#10185 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 1-2 days Newbie friendliness 45/100
clerk/javascript#10118 ·
Maintainers usually reply within 1 day
All issues in clerk/javascript
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NousResearch/hermes-agent#136483 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
vercel/ai#22796 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug]: Web chat input doesn't regain focus after a reply finishesPossibly taken @GaijinSystems claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zeroclaw-labs/zeroclaw#11658 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
babylonlabs-io/babylon-toolkit#2711 ·
Maintainers usually reply within 1 day