feat(clerk-js): Trigger a new request to submit the captcha token
Description
This PR introduces support for a two-request sign up creation. This only happens when the bot-protection is enabled, so the client fires a POST on /sign_ups without a captcha token, and immediately a PATCH on /sign_ups/sua_XXX with the captcha token.
After the first API call, the Sign Up Attempt will include the captcha_challenge string inside the missing_fields array.
This is part of a bigger effort to decouple the initial sign up attempt creation from the submission of a challenge (like CAPTCHA token, or a device attestation proof).
It also fixes a rare bug on sign ups, where a captcha challenge was triggered, while we only wanted to clear the error message by triggering a new sign up attempt. That's why an option named skipCaptchaChallenge is also introduced.
The new functionality is enabled only when the display_config.two_step_sign_up_create_enabled boolean feature flag is true. This way we will rollout the new functionality gradually, and eventually totally remove the legacy code.
Our backend will still support both ways of submitting a CAPTCHA to provide backwards compatibility.
Checklist
- [x]
pnpm testruns as expected. - [x]
pnpm buildruns 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
- [x] 🌟 New feature
- [ ] 🔨 Breaking change
- [ ] 📖 Refactoring / dependency upgrade / documentation
- [ ] other:
Summary by CodeRabbit
-
New Features
- Improved sign-up process with enhanced captcha challenge handling, including a new two-step sign-up flow controlled by a feature flag.
- Added support for skipping captcha challenges during specific sign-up scenarios.
-
Bug Fixes
- Unified and simplified error handling for captcha challenges during sign-up.
-
Chores
- Updated internal types and configuration options to support new sign-up and captcha features.
🦋 Changeset detected
Latest commit: c7da4d3e94c4f10a0ec7e9170bdd1771fe1da9f3
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 22 packages
| Name | Type |
|---|---|
| @clerk/clerk-js | Patch |
| @clerk/types | Patch |
| @clerk/chrome-extension | Patch |
| @clerk/clerk-expo | Patch |
| @clerk/agent-toolkit | Patch |
| @clerk/astro | Patch |
| @clerk/backend | Patch |
| @clerk/elements | Patch |
| @clerk/expo-passkeys | Patch |
| @clerk/express | Patch |
| @clerk/fastify | Patch |
| @clerk/localizations | Patch |
| @clerk/nextjs | Patch |
| @clerk/nuxt | Patch |
| @clerk/react-router | Patch |
| @clerk/clerk-react | Patch |
| @clerk/remix | Patch |
| @clerk/shared | Patch |
| @clerk/tanstack-react-start | Patch |
| @clerk/testing | Patch |
| @clerk/themes | Patch |
| @clerk/vue | Patch |
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 Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| clerk-js-sandbox | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 25, 2025 3:48pm |
!snapshot
Hey @anagstef - the snapshot version command generated the following package versions:
| Package | Version |
|---|---|
| @clerk/agent-toolkit | 0.1.0-snapshot.v20250606145508 |
| @clerk/astro | 2.9.0-snapshot.v20250606145508 |
| @clerk/backend | 2.0.0-snapshot.v20250606145508 |
| @clerk/chrome-extension | 2.4.11-snapshot.v20250606145508 |
| @clerk/clerk-js | 5.68.0-snapshot.v20250606145508 |
| @clerk/elements | 0.23.32-snapshot.v20250606145508 |
| @clerk/clerk-expo | 2.13.0-snapshot.v20250606145508 |
| @clerk/expo-passkeys | 0.3.9-snapshot.v20250606145508 |
| @clerk/express | 1.6.0-snapshot.v20250606145508 |
| @clerk/fastify | 2.3.0-snapshot.v20250606145508 |
| @clerk/localizations | 3.16.4-snapshot.v20250606145508 |
| @clerk/nextjs | 6.21.0-snapshot.v20250606145508 |
| @clerk/nuxt | 1.7.0-snapshot.v20250606145508 |
| @clerk/clerk-react | 5.31.9-snapshot.v20250606145508 |
| @clerk/react-router | 1.5.0-snapshot.v20250606145508 |
| @clerk/remix | 4.8.0-snapshot.v20250606145508 |
| @clerk/shared | 3.9.6-snapshot.v20250606145508 |
| @clerk/tanstack-react-start | 0.16.0-snapshot.v20250606145508 |
| @clerk/testing | 1.8.0-snapshot.v20250606145508 |
| @clerk/themes | 2.2.49-snapshot.v20250606145508 |
| @clerk/types | 4.60.0-snapshot.v20250606145508 |
| @clerk/vue | 1.8.7-snapshot.v20250606145508 |
Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit
npm i @clerk/[email protected] --save-exact
@clerk/astro
npm i @clerk/[email protected] --save-exact
@clerk/backend
npm i @clerk/[email protected] --save-exact
@clerk/chrome-extension
npm i @clerk/[email protected] --save-exact
@clerk/clerk-js
npm i @clerk/[email protected] --save-exact
@clerk/elements
npm i @clerk/[email protected] --save-exact
@clerk/clerk-expo
npm i @clerk/[email protected] --save-exact
@clerk/expo-passkeys
npm i @clerk/[email protected] --save-exact
@clerk/express
npm i @clerk/[email protected] --save-exact
@clerk/fastify
npm i @clerk/[email protected] --save-exact
@clerk/localizations
npm i @clerk/[email protected] --save-exact
@clerk/nextjs
npm i @clerk/[email protected] --save-exact
@clerk/nuxt
npm i @clerk/[email protected] --save-exact
@clerk/clerk-react
npm i @clerk/[email protected] --save-exact
@clerk/react-router
npm i @clerk/[email protected] --save-exact
@clerk/remix
npm i @clerk/[email protected] --save-exact
@clerk/shared
npm i @clerk/[email protected] --save-exact
@clerk/tanstack-react-start
npm i @clerk/[email protected] --save-exact
@clerk/testing
npm i @clerk/[email protected] --save-exact
@clerk/themes
npm i @clerk/[email protected] --save-exact
@clerk/types
npm i @clerk/[email protected] --save-exact
@clerk/vue
npm i @clerk/[email protected] --save-exact
📝 Walkthrough
Walkthrough
This change introduces a patch update for the '@clerk/clerk-js' and '@clerk/types' packages, focusing on the sign-up process and captcha handling. A new feature flag, twoStepSignUpCreateEnabled, is added to the display configuration, allowing for a two-step sign-up creation flow. The SignUp class's create method is refactored to support both legacy and two-step flows, with modularized captcha challenge handling. Related type definitions are updated to accommodate new options and attributes, including the addition of SignUpCreateOptions and CaptchaChallengeAttribute. Minor adjustments are also made to error handling and OAuth error reset logic.
Suggested reviewers
- panteliselef
- wobsoriano
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between aa783a5f878ce6998f0be51cd3c40d4e2d212984 and c7da4d3e94c4f10a0ec7e9170bdd1771fe1da9f3.
📒 Files selected for processing (1)
-
packages/clerk-js/src/core/resources/SignUp.ts(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/clerk-js/src/core/resources/SignUp.ts
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Build Packages
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
!snapshot
Hey @anagstef - the snapshot version command generated the following package versions:
| Package | Version |
|---|---|
| @clerk/chrome-extension | 2.4.13-snapshot.v20250616134309 |
| @clerk/clerk-js | 5.69.1-snapshot.v20250616134309 |
| @clerk/clerk-expo | 2.13.2-snapshot.v20250616134309 |
Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/chrome-extension
npm i @clerk/[email protected] --save-exact
@clerk/clerk-js
npm i @clerk/[email protected] --save-exact
@clerk/clerk-expo
npm i @clerk/[email protected] --save-exact
@clerk/agent-toolkit
npm i https://pkg.pr.new/@clerk/agent-toolkit@6076
@clerk/astro
npm i https://pkg.pr.new/@clerk/astro@6076
@clerk/backend
npm i https://pkg.pr.new/@clerk/backend@6076
@clerk/chrome-extension
npm i https://pkg.pr.new/@clerk/chrome-extension@6076
@clerk/clerk-js
npm i https://pkg.pr.new/@clerk/clerk-js@6076
@clerk/dev-cli
npm i https://pkg.pr.new/@clerk/dev-cli@6076
@clerk/elements
npm i https://pkg.pr.new/@clerk/elements@6076
@clerk/clerk-expo
npm i https://pkg.pr.new/@clerk/clerk-expo@6076
@clerk/expo-passkeys
npm i https://pkg.pr.new/@clerk/expo-passkeys@6076
@clerk/express
npm i https://pkg.pr.new/@clerk/express@6076
@clerk/fastify
npm i https://pkg.pr.new/@clerk/fastify@6076
@clerk/localizations
npm i https://pkg.pr.new/@clerk/localizations@6076
@clerk/nextjs
npm i https://pkg.pr.new/@clerk/nextjs@6076
@clerk/nuxt
npm i https://pkg.pr.new/@clerk/nuxt@6076
@clerk/clerk-react
npm i https://pkg.pr.new/@clerk/clerk-react@6076
@clerk/react-router
npm i https://pkg.pr.new/@clerk/react-router@6076
@clerk/remix
npm i https://pkg.pr.new/@clerk/remix@6076
@clerk/shared
npm i https://pkg.pr.new/@clerk/shared@6076
@clerk/tanstack-react-start
npm i https://pkg.pr.new/@clerk/tanstack-react-start@6076
@clerk/testing
npm i https://pkg.pr.new/@clerk/testing@6076
@clerk/themes
npm i https://pkg.pr.new/@clerk/themes@6076
@clerk/types
npm i https://pkg.pr.new/@clerk/types@6076
@clerk/upgrade
npm i https://pkg.pr.new/@clerk/upgrade@6076
@clerk/vue
npm i https://pkg.pr.new/@clerk/vue@6076
commit: c7da4d3
!snapshot
Hey @anagstef - the snapshot version command generated the following package versions:
| Package | Version |
|---|---|
| @clerk/agent-toolkit | 0.1.2-snapshot.v20250618161931 |
| @clerk/astro | 2.9.2-snapshot.v20250618161931 |
| @clerk/backend | 2.2.0-snapshot.v20250618161931 |
| @clerk/chrome-extension | 2.4.13-snapshot.v20250618161931 |
| @clerk/clerk-js | 5.69.1-snapshot.v20250618161931 |
| @clerk/elements | 0.23.34-snapshot.v20250618161931 |
| @clerk/clerk-expo | 2.13.2-snapshot.v20250618161931 |
| @clerk/expo-passkeys | 0.3.11-snapshot.v20250618161931 |
| @clerk/express | 1.7.1-snapshot.v20250618161931 |
| @clerk/fastify | 2.4.1-snapshot.v20250618161931 |
| @clerk/localizations | 3.16.6-snapshot.v20250618161931 |
| @clerk/nextjs | 6.23.0-snapshot.v20250618161931 |
| @clerk/nuxt | 1.7.2-snapshot.v20250618161931 |
| @clerk/clerk-react | 5.32.1-snapshot.v20250618161931 |
| @clerk/react-router | 1.6.1-snapshot.v20250618161931 |
| @clerk/remix | 4.8.2-snapshot.v20250618161931 |
| @clerk/shared | 3.9.8-snapshot.v20250618161931 |
| @clerk/tanstack-react-start | 0.18.0-snapshot.v20250618161931 |
| @clerk/testing | 1.8.2-snapshot.v20250618161931 |
| @clerk/themes | 2.2.51-snapshot.v20250618161931 |
| @clerk/types | 4.61.0-snapshot.v20250618161931 |
| @clerk/vue | 1.8.9-snapshot.v20250618161931 |
Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit
npm i @clerk/[email protected] --save-exact
@clerk/astro
npm i @clerk/[email protected] --save-exact
@clerk/backend
npm i @clerk/[email protected] --save-exact
@clerk/chrome-extension
npm i @clerk/[email protected] --save-exact
@clerk/clerk-js
npm i @clerk/[email protected] --save-exact
@clerk/elements
npm i @clerk/[email protected] --save-exact
@clerk/clerk-expo
npm i @clerk/[email protected] --save-exact
@clerk/expo-passkeys
npm i @clerk/[email protected] --save-exact
@clerk/express
npm i @clerk/[email protected] --save-exact
@clerk/fastify
npm i @clerk/[email protected] --save-exact
@clerk/localizations
npm i @clerk/[email protected] --save-exact
@clerk/nextjs
npm i @clerk/[email protected] --save-exact
@clerk/nuxt
npm i @clerk/[email protected] --save-exact
@clerk/clerk-react
npm i @clerk/[email protected] --save-exact
@clerk/react-router
npm i @clerk/[email protected] --save-exact
@clerk/remix
npm i @clerk/[email protected] --save-exact
@clerk/shared
npm i @clerk/[email protected] --save-exact
@clerk/tanstack-react-start
npm i @clerk/[email protected] --save-exact
@clerk/testing
npm i @clerk/[email protected] --save-exact
@clerk/themes
npm i @clerk/[email protected] --save-exact
@clerk/types
npm i @clerk/[email protected] --save-exact
@clerk/vue
npm i @clerk/[email protected] --save-exact