Skip to content

feat(ui,clerk-js,backend,shared): connect API key services in Clerk Connect - #10919

Draft
brkalow wants to merge 10 commits into
brk/clerk-connect-uifrom
brk/clerk-connect-api-keys
Draft

brkalow wants to merge 10 commits into
brk/clerk-connect-uifrom
brk/clerk-connect-api-keys

Conversation

@brkalow

@brkalow brkalow commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Requested by Bryce

Description

Adds API key connectors to Clerk Connect in the SDKs and <UserProfile />. When a connector's authenticationMethod is api_key, picking it under Connected services opens a key form with the connector's instructions and help link, instead of redirecting. The row shows only a masked hint, and the menu offers "Replace API key". On the backend, clerkClient.connect.connections.getCredential({ userId, key }) returns { type: 'api_key', apiKey }.

Stacked on #10649. Backend: clerk/clerk_go#24384. Related: #10919, clerk/dashboard#10837.

  • @clerk/shared: AvailableConnector.authenticationMethod and apiKey help, CurrentUserConnection.apiKeyHint, optional returnUrl and apiKey on create and reauthorize.
  • @clerk/backend: ConnectConnectionCredential is a union of OAuth and API key credentials. create and reauthorize accept apiKey, and connector configuration accepts { type: 'api_key', instructions?, helpUrl? }.
  • @clerk/ui: the key form, Replace API key, and the hint. Picking a connector whose only connection is disconnected now reconnects it, for OAuth too, instead of adding github-2.
  • @clerk/localizations: new connectionsSection.apiKeyForm strings and actionLabel__replaceApiKey.

Checklist

  • pnpm test runs as expected. Ran ConnectionsSection (11), ConnectApi (4) and the clerk-js connect module (2).
  • pnpm build runs as expected. Built shared and localizations, and typechecked ui and backend.
  • (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 19, 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 21, 2026 4:29am UTC
mosaic-docs Error Error Nov 21, 2026 4:29am UTC
swingset Ready Ready Preview Nov 21, 2026 4:29am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 19, 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

@changeset-bot

changeset-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b747678

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@clerk/shared Minor
@clerk/clerk-js Minor
@clerk/ui Minor
@clerk/backend Minor
@clerk/localizations Minor
@clerk/astro Patch
@clerk/chrome-extension Patch
@clerk/electron Patch
@clerk/expo-passkeys Patch
@clerk/expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/mosaic Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/swingset Patch
@clerk/tanstack-react-start Patch
@clerk/testing 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

…onnect

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brkalow and others added 9 commits November 20, 2026 21:57
ClerkAPIError only copied known meta keys, so connection_id,
connection_status, missing_scopes, scopes_not_allowed, connector and
available_expires_in were dropped for both FAPI and BAPI errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
err.message was the HTTP reason ("Conflict", "Not Found"). Connect API
errors now carry the error's long_message (or message), and keep the
parsed errors with their meta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
The UserProfile API key form uses the `apiKey` field id, which FieldId
did not list, so @clerk/ui failed to type-check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
…me on connections

Connections now carry connectorStatus ('active' | 'disabled') and
connectorDisplayName, so an app can name and explain a connection whose
connector the admin turned off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
…erProfile

- One message per clerk_connect_error code, naming the service the flow
  went to (remembered in sessionStorage before the redirect).
  account_already_connected no longer says to try again. Unknown codes
  keep the generic message.
- The banner clears on the next action (opening the menu or a row
  action, connecting, saving a key) and on a successful connect.
- Rows use connectorDisplayName. A connection of a disabled connector
  shows an Unavailable badge and why, with no Reconnect or Replace; its
  disconnected rows are no longer hidden.
- Each row shows its slug, so two accounts of one service differ.
- Opening the Connect service menu closes an open Replace form.
- Reconnect sits with the row actions, and the menu entry that
  reconnects names the account it reconnects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
…horize disconnected slugs

- create() and reauthorize() no longer resolve after they start the
  redirect: the promise never settles, so code after the await does not
  run on an unloading page. `redirect: false` returns the
  requires_action result (with action.url) without navigating.
- create() on a slug whose connection is disconnected or needs attention
  (409 connection_reauthorization_required with meta.connection_id)
  reauthorizes that connection with the same returnUrl, scopes and
  apiKey.
- Errors from these calls name SDK parameters (returnUrl, apiKey,
  additionalAccount) instead of API ones, in message, long message and
  meta.paramName.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
Adds ConnectionWebhookEvent (connection.created, connection.updated,
connection.deleted) to the WebhookEvent union. Its payload is the
Backend API connection object, with no credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
The API key changeset still documented getCredential({ userId, key }).
It now uses slug, and a new changeset covers the connection fields, the
redirect option, the error changes and the webhook types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk
React calls a state initializer twice in development, and the first call
removed the remembered connector, so the banner said "the service". The key
is now removed in an effect after the first render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BC1KwbuJdMgSFbBuHqcqEk

This branch was successfully deployed

2 active deployments
Preview – swingset — b747678b Deployed Nov 21, 2026 by vercel[bot]
Preview – clerk-js-sandbox — b747678b Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant