Releases: clerk/javascript
@clerk/[email protected]
Major Changes
- Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
Minor Changes
- Add
/typessubpath export to re-export types from@clerk/shared/typesalong with SDK-specific types. This allows importing Clerk types directly from the SDK package (e.g.,import type { UserResource } from '@clerk/react/types') without needing to install@clerk/typesas a separate dependency. (#7644) by @nikosdouvlis
Patch Changes
- Updated dependencies [
0a9cce3,e35960f,c9f0d77,1bd1747,6a2ff9e,d2cee35,44d0e5c,6ec5f08,0a9cce3,8c47111,00882e8,a374c18,466d642,5ef4a77,3abe9ed,af85739,10b5bea,a05d130,b193f79,e9d2f2f,6e90b7f,43fc7b7,0f1011a,cbc5618,38def4f,7772f45,a3e689f,583f7a9,965e7f1,84483c2,2b76081,f284c3d,ac34168,cf0d0dc,0aff70e,690280e,b971d0b,22d1689,e9a1d4d,c088dde,8902e21,972f6a0,a1aaff3,d85646a,ab3dd16,4a8cb10,fd195c1,8887fac,0b4b481,5f88dbb,dc886a9,428629b,8b95393,c438fa5,c438fa5,fd195c1,fd69edb,8d91225,1fc95e2,3dac245,a4c3b47,7c3c002,d8bbc66,3983cf8,f1f1d09,736314f,2cc7dbb,0af2e6f,86d2199,da415c8,97c9ab3,cc63aab,a7a38ab,cfa70ce,25d37b0,26254f0,c97e6af,5b24266,d98727e,79e2622,12b3070]:- @clerk/[email protected]
- @clerk/[email protected]
@clerk/[email protected]
Major Changes
-
Remove deprecated
enableHandshakeoption andreq.authobject-access pattern. (#7926) by @wobsorianoenableHandshakeremovedThis option had no effect and was previously deprecated. Remove it from your
clerkMiddlewarecall:// Before app.use(clerkMiddleware({ enableHandshake: false })); // After app.use(clerkMiddleware());
req.authmust now be called as a functionAccessing
req.authas a plain object (legacyclerk-sdk-nodestyle) no longer works. UsegetAuth()instead:// Before const { userId } = req.auth; // After const { userId } = getAuth(req);
-
Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
-
Remove
clerkJSUrl,clerkJSVersion,clerkUIUrl, andclerkUIVersionprops from all SDKs. To pin a specific version of@clerk/clerk-js, import theClerkconstructor from@clerk/clerk-jsand pass it toClerkProvidervia theClerkprop. To pin a specific version of@clerk/ui, importuifrom@clerk/uiand pass it via theuiprop. This bundles the modules directly with your application instead of loading them from the CDN. (#7879) by @jacekradko
Minor Changes
-
Add Frontend API proxy support via
frontendApiProxyoption inclerkMiddleware(#7602) by @brkalow -
Add
/typessubpath export to re-export types from@clerk/shared/typesalong with SDK-specific types. This allows importing Clerk types directly from the SDK package (e.g.,import type { UserResource } from '@clerk/react/types') without needing to install@clerk/typesas a separate dependency. (#7644) by @nikosdouvlis
Patch Changes
-
Wire
clerkUIVersionoption through all framework packages (#7740) by @nikosdouvlis -
Updated dependencies [
0a9cce3,e35960f,c9f0d77,1bd1747,6a2ff9e,d2cee35,44d0e5c,6ec5f08,0a9cce3,8c47111,00882e8,a374c18,466d642,5ef4a77,3abe9ed,af85739,10b5bea,a05d130,b193f79,e9d2f2f,6e90b7f,43fc7b7,0f1011a,cbc5618,38def4f,7772f45,a3e689f,583f7a9,965e7f1,84483c2,2b76081,f284c3d,ac34168,cf0d0dc,0aff70e,690280e,b971d0b,22d1689,e9a1d4d,c088dde,8902e21,972f6a0,a1aaff3,d85646a,ab3dd16,4a8cb10,fd195c1,8887fac,0b4b481,5f88dbb,dc886a9,428629b,8b95393,c438fa5,c438fa5,fd195c1,fd69edb,8d91225,1fc95e2,3dac245,a4c3b47,7c3c002,d8bbc66,3983cf8,f1f1d09,736314f,2cc7dbb,0af2e6f,86d2199,da415c8,97c9ab3,cc63aab,a7a38ab,cfa70ce,25d37b0,26254f0,c97e6af,5b24266, [d98727e](https://github.com/...
@clerk/[email protected]
Major Changes
-
Align experimental/unstable prefixes to use consistent naming: (#7361) by @brkalow
- Renamed all
__unstable_*methods to__internal_*(for internal APIs) - Renamed all
experimental__*andexperimental_*methods to__experimental_*(for beta features) - Removed deprecated billing-related props (
__unstable_manageBillingUrl,__unstable_manageBillingLabel,__unstable_manageBillingMembersLimit) andexperimental__forceOauthFirst
- Renamed all
-
Move
useSignInWithAppleanduseSignInWithGoogleto dedicated entry points to avoid bundling optional dependencies. (#7737) by @chriscaninBreaking Change: Import paths have changed:
// Before import { useSignInWithApple } from '@clerk/expo'; import { useSignInWithGoogle } from '@clerk/expo'; // After import { useSignInWithApple } from '@clerk/expo/apple'; import { useSignInWithGoogle } from '@clerk/expo/google';
This change prevents
expo-cryptoandexpo-apple-authenticationfrom being bundled when not using native sign-in hooks. -
Refactor React SDK hooks to subscribe to auth state via
useSyncExternalStore. This is a mostly internal refactor to unlock future improvements, but includes a few breaking changes and fixes. (#7411) by @EphemBreaking changes:
- Removes ability to pass in
initialAuthStatetouseAuth- This was added for internal use and is no longer needed
- Instead pass in
initialStateto the<ClerkProvider>, ordynamicif using the Next package - See your specific SDK documentation for more information on Server Rendering
Fixes:
- A bug where
useAuthwould sometimes briefly return theinitialStaterather thanundefined- This could in certain situations incorrectly lead to a brief
user: nullon the first page after signing in, indicating a signed out state
- This could in certain situations incorrectly lead to a brief
- Hydration mismatches in certain rare scenarios where subtrees would suspend and hydrate only after
clerk-jshad loaded fully
- Removes ability to pass in
-
The
publishableKeyprop is now required inClerkProvider. Previously, the prop was optional and would fall back toEXPO_PUBLIC_CLERK_PUBLISHABLE_KEYorCLERK_PUBLISHABLE_KEYenvironment variables. (#7655) by @chriscaninEnvironment variables inside
node_modulesare not inlined during production builds in React Native/Expo, which could cause apps to crash in production when the publishable key is undefined.You must now explicitly pass the
publishableKeyprop toClerkProvider:const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!; <ClerkProvider publishableKey={publishableKey}>{/* Your app */}</ClerkProvider>;
-
Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
-
Removed legacy subpath export mappings in favor of modern package.json
exportsfield configuration. Previously, these packages used a workaround to support subpath imports (e.g.,@clerk/shared/react,@clerk/expo/web). All public APIs remain available through the main package entry points. (#7925) by @jacekradko -
Drop support for Expo 50, 51 and 52 with updated peer dependency requirements: (#7016) by @nikosdouvlis
@clerk/expo
- Added new peer dependency:
expo: >=53 <55- The core
expopackage is now explicitly required as a peer dependency - This ensures compatibility with the Expo SDK version range that supports the features used by Clerk
- The core
@clerk/expo-passkeys
- Updated peer dependency:
expo: >=53 <55(previously>=50 <55)- Minimum Expo version increased from 50 to 53
- This aligns with the main
@clerk/expopackage requirements
- Added new peer dependency:
-
Introduce
<Show when={...}>as the cross-framework authorization control component and remove<Protect>,<SignedIn>, and<SignedOut>in favor of<Show>. (#7373) by @jacekradko -
Remove deprecated
Clerkexport in favor ofgetClerkInstance(). (#7519) by @wobsoriano- import { Clerk } from '@clerk/clerk-expo'; + import { getClerkInstance } from '@clerk/expo'; - const token = await Clerk.session?.getToken(); + const token = await getClerkInstance().session?.getToken();
If you need to create the instance before
ClerkProviderrenders, pass thepublishableKey:import { ClerkProvider, getClerkInstance } from '@clerk/expo'; const clerkInstance = getClerkInstance({ publishableKey: 'pk_xxx' }); // Use the instance outside of React const token = await clerkInstance?.session?.getToken(); fetch('https://example.com/api', { headers: { Authorization: `Bearer ${token}` } });
[!NOTE]
- Calling
getClerkInstance()with different publishable keys will create a new Clerk instance. - If
getClerkInstanceis called without a publishable key, andClerkProviderhas not rendered yet, an error will be thrown.
- Calling
Minor Changes
-
Add native Google Sign-In support for iOS and Android using built-in native modules. (#7208) by @chriscanin
-
Remove
clerkJSVariantoption and headless bundle. UseprefetchUI={false}instead. (#7629) by @jacekradko -
Add
/typessubpath export to re-export types from@clerk/shared/typesalong with SDK-specific types. This allows importing Clerk types directly from the SDK package (e.g.,import type { UserResource } from '@clerk/react/types') without needing to install@clerk/typesas a separate dependency. (#7644) by @nikosdouvlis -
Introduce
<UNSAFE_PortalProvider>component which allows you to specify a custom container for Clerk floating UI elements (popovers, modals, tooltips, etc.) that use portals. Only Clerk components within the provider will be affected, components outside the provider will continue to use the default document.body for portals. (#7310) by @alexcarpenterThis is particularly useful when using Clerk components inside external UI libraries like Radix Dialog or React Aria Components, where portaled elements need to render within the dialog's container to remain interact-able.
'use client'; import { useRef } from 'react'; import * as Dialog from '@radix-ui/react-dialog'; import { UNSAFE_PortalProvider, UserButton } from '@clerk/nextjs'; export function UserDialog() { const containerRef = useRef<HTMLDivElement>(null); return ( <Dialog.Root> <Dialog.Trigger>Open Dialog</Dialog.Trigger> <Dialog.Portal> <Dialog.Overlay /> <Dialog.Content ref={containerRef}> <UNSAFE_PortalProvider getContainer={() => containerRef.current}> <UserButton /> </UNSAFE_PortalProvider> </Dialog.Content> </Dialog.Portal> </Dialog.Root> ); }
Patch Changes
-
-
Prevent DOM-based captcha from hanging in React Native environments (#7967) by @chriscanin
-
Make
expo-auth-sessionandexpo-web-browseroptional via dynamic imports -
Re-export
RedirectToTasksandShowcontrol components
-
-
Add exports for
useWaitlisthook. (#7609) by @alexcarpenter -
Updated dependencies [
0a9cce3,e35960f,c438fa5,c9f0d77,1bd1747,6a2ff9e,79bbbed,c438fa5,c438fa5,d2cee35, [fa75344](fa75344...
@clerk/[email protected]
Major Changes
-
Drop support for Expo 50, 51 and 52 with updated peer dependency requirements: (#7016) by @nikosdouvlis
@clerk/expo
- Added new peer dependency:
expo: >=53 <55- The core
expopackage is now explicitly required as a peer dependency - This ensures compatibility with the Expo SDK version range that supports the features used by Clerk
- The core
@clerk/expo-passkeys
- Updated peer dependency:
expo: >=53 <55(previously>=50 <55)- Minimum Expo version increased from 50 to 53
- This aligns with the main
@clerk/expopackage requirements
- Added new peer dependency:
Patch Changes
- Updated dependencies [
0a9cce3,e35960f,c9f0d77,1bd1747,6a2ff9e,d2cee35,0a9cce3,a374c18,466d642,5ef4a77,af85739,10b5bea,a05d130,b193f79,e9d2f2f,43fc7b7,0f1011a,cbc5618,38def4f,7772f45,a3e689f,583f7a9,965e7f1,2b76081,f284c3d,ac34168,cf0d0dc,690280e,b971d0b,22d1689,e9a1d4d,c088dde,8902e21,972f6a0,a1aaff3,d85646a,ab3dd16,4a8cb10,fd195c1,8887fac,dc886a9,428629b,8b95393,c438fa5,c438fa5,fd195c1,fd69edb,8d91225,1fc95e2,3dac245,a4c3b47,7c3c002,d8bbc66,3983cf8,f1f1d09,736314f,2cc7dbb,86d2199,da415c8,97c9ab3,cc63aab,a7a38ab,cfa70ce,25d37b0,26254f0,c97e6af,d98727e,79e2622,12b3070]:- @clerk/[email protected]
@clerk/[email protected]
Minor Changes
- Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
Patch Changes
- Replace
globbydependency withtinyglobbyfor smaller bundle size and faster installation (#7415) by @alexcarpenter
@clerk/[email protected]
Major Changes
-
Align experimental/unstable prefixes to use consistent naming: (#7361) by @brkalow
- Renamed all
__unstable_*methods to__internal_*(for internal APIs) - Renamed all
experimental__*andexperimental_*methods to__experimental_*(for beta features) - Removed deprecated billing-related props (
__unstable_manageBillingUrl,__unstable_manageBillingLabel,__unstable_manageBillingMembersLimit) andexperimental__forceOauthFirst
- Renamed all
-
Renamed unstable methods to internal: (#7925) by @jacekradko
__unstable__environment→__internal_environment__unstable__updateProps→__internal_updateProps__unstable__setEnvironment→__internal_setEnvironment__unstable__onBeforeRequest→__internal_onBeforeRequest__unstable__onAfterResponse→__internal_onAfterResponse__unstable__onBeforeSetActive→__internal_onBeforeSetActive(window global)__unstable__onAfterSetActive→__internal_onAfterSetActive(window global)
-
Add proactive session token refresh. Tokens are now automatically refreshed in the background before they expire, reducing latency for API calls near token expiration. (#7317) by @jacekradko
-
Updated returned values of
Clerk.checkout()anduseCheckout. (#7232) by @panteliselefVanilla JS
// Before const { getState, subscribe, confirm, start, clear, finalize } = Clerk.checkout({ planId: 'xxx', planPeriod: 'annual', }); getState().isStarting; getState().isConfirming; getState().error; getState().checkout; getState().fetchStatus; getState().status; // After const { checkout, errors, fetchStatus } = Clerk.checkout({ planId: 'xxx', planPeriod: 'annual' }); checkout.plan; // null or defined based on `checkout.status` checkout.status; checkout.start; checkout.confirm;
React
// Before const { id, plan, status, start, confirm, paymentSource } = useCheckout({ planId: 'xxx', planPeriod: 'annual' }); // After const { checkout, errors, fetchStatus } = usecCheckout({ planId: 'xxx', planPeriod: 'annual' }); checkout.plan; // null or defined based on `checkout.status` checkout.status; checkout.start; checkout.confirm;
-
Remove deprecated
samlproperty fromUserSettingsin favor ofenterpriseSSO(#7063) by @LauraBeatris -
Remove deprecated
samlAccountin favor ofenterpriseAccount(#7258) by @LauraBeatris -
Remove
clerkJSVariantoption and headless bundle. UseprefetchUI={false}instead. (#7629) by @jacekradko -
Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
-
Remove all previously deprecated UI props across the Next.js, React and clerk-js SDKs. The legacy
afterSign(In|Up)Url/redirectUrlprops,UserButtonsign-out overrides, organizationhideSlugflags,OrganizationSwitcher'safterSwitchOrganizationUrl,Client.activeSessions,setActive({ beforeEmit }), and theClerkMiddlewareAuthObjecttype alias are no longer exported. Components now rely solely on the new redirect options and server-side configuration. (#7243) by @jacekradko -
Remove deprecated
samlstrategy in favor ofenterprise_sso(#7326) by @LauraBeatris -
getToken()now throwsClerkOfflineErrorinstead of returningnullwhen the client is offline. (#7598) by @bratsosThis makes it explicit that a token fetch failure was due to network conditions, not authentication state. Previously, returning
nullcould be misinterpreted as "user is signed out," potentially causing the cached token to be cleared.To handle this change, catch
ClerkOfflineErrorfromgetToken()calls:import { ClerkOfflineError } from '@clerk/react/errors'; try { const token = await session.getToken(); } catch (error) { if (ClerkOfflineError.is(error)) { // Handle offline scenario - show offline UI, retry later, etc. } throw error; }
Minor Changes
-
Add support for email link based verification to SignUpFuture (#7745) by @dstaley
-
Surface organization creation defaults with prefilled form fields and advisory warnings (#7488) by @LauraBeatris
-
Reuse SignIn and SignUp instances on Client when processing Client response JSON. (#7803) by @dstaley
-
addListenernow takes askipInitialEmitoption that can be used to avoid emitting immediately after subscribing. (#7925) by @jacekradko -
UI components are now provided by the new
@clerk/uipackage, loaded automatically from the Clerk CDN. (#7925) by @jacekradko -
Don't display impersonation overlay for agents (#7933) by @tmilewski
-
Hide the "Remove" action from the last available 2nd factor strategy when MFA is required (#7729) by @octoper
-
Renames
mountTaskSetupMfaandunmountTaskSetupMfatomountTaskSetupMFAandunmountTaskSetupMFArespectively (#7859) by @octoper -
Add
unsafe_disableDevelopmentModeConsoleWarningoption to disable the development mode warning that's emitted to the console when Clerk is first loaded. (#7505) by @dstaley -
Refactor React SDK hooks to subscribe to auth state via
useSyncExternalStore. This is a mostly internal refactor to unlock future improvements, but includes a few breaking changes and fixes. (#7411) by @EphemBreaking changes:
- Removes ability to pass in
initialAuthStatetouseAuth- This was added for internal use and is no longer needed
- Instead pass in
initialStateto the<ClerkProvider>, ordynamicif using the Next package - See your specific SDK documentation for more information on Server Rendering
Fixes:
- A bug where
useAuthwould sometimes briefly return theinitialStaterather thanundefined- This could in certain situations incorrectly lead to a brief
user: nullon the first page after signing in, indicating a signed out state
- This could in certain situations incorrectly lead to a brief
- Hydration mismatches in certain rare scenarios where subtrees would suspend and hydrate only after
clerk-jshad loaded fully
- Removes ability to pass in
-
Add support for email code MFA to SignInFuture (#7594) by @dstaley
-
Add additional verification fields to SignUpFuture. (#7666) by @dstaley
-
Add support for resetting a password via phone code. (#7824) by @dstaley
-
Disable role selection in
OrganizationProfileduring role set migration (#7534) by @LauraBeatris -
Add Safari ITP (Intelligent Tracking Prevention) cookie refresh support. (#7623) by @nikosdouvlis
Safari's ITP limits cookies set via JavaScript to 7 days. When a session cookie is close to expiring (within 8 days), Clerk now automatically routes navigations through a
/v1/client/touchendpoint to refresh the cookie via a full-page navigation, bypassing the 7-day cap.For developers using a custom
navigatecallback insetActive(), a newdecorateUrlfunction is passed to the callback. Use it to wrap your destination URL:await clerk.setActive({ session: newSession, navigate: ({ decorateUrl }) => { const url = decorateUrl('/dashboard'); window.location.href = url; }, });
The
decorateUrlfunction returns the original URL unchanged when the Safari ITP fix is not needed, so it's safe to always use it. -
Add
satelliteAutoSyncoption to optimize satellite app handshake behavior (#7597) by @nikosdouvlisSatellite apps currently trigger a handshake redirect on every first page load, even when no cookies exist. This creates unnecessary redirec...
@clerk/[email protected]
Major Changes
-
Align experimental/unstable prefixes to use consistent naming: (#7361) by @brkalow
- Renamed all
__unstable_*methods to__internal_*(for internal APIs) - Renamed all
experimental__*andexperimental_*methods to__experimental_*(for beta features) - Removed deprecated billing-related props (
__unstable_manageBillingUrl,__unstable_manageBillingLabel,__unstable_manageBillingMembersLimit) andexperimental__forceOauthFirst
- Renamed all
-
Renamed
__unstable__createClerkClienttocreateClerkClient(exported from@clerk/chrome-extension/background). (#7925) by @jacekradko -
Refactor React SDK hooks to subscribe to auth state via
useSyncExternalStore. This is a mostly internal refactor to unlock future improvements, but includes a few breaking changes and fixes. (#7411) by @EphemBreaking changes:
- Removes ability to pass in
initialAuthStatetouseAuth- This was added for internal use and is no longer needed
- Instead pass in
initialStateto the<ClerkProvider>, ordynamicif using the Next package - See your specific SDK documentation for more information on Server Rendering
Fixes:
- A bug where
useAuthwould sometimes briefly return theinitialStaterather thanundefined- This could in certain situations incorrectly lead to a brief
user: nullon the first page after signing in, indicating a signed out state
- This could in certain situations incorrectly lead to a brief
- Hydration mismatches in certain rare scenarios where subtrees would suspend and hydrate only after
clerk-jshad loaded fully
- Removes ability to pass in
-
Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
-
Introduce
<Show when={...}>as the cross-framework authorization control component and remove<Protect>,<SignedIn>, and<SignedOut>in favor of<Show>. (#7373) by @jacekradko
Minor Changes
-
Remove
clerkJSVariantoption and headless bundle. UseprefetchUI={false}instead. (#7629) by @jacekradko -
Add
uiprop toClerkProviderfor passing@clerk/ui(#7664) by @jacekradko -
Export
useOrganizationCreationDefaultshook to fetch suggested organization name and logo from default naming rules (#7694) by @LauraBeatris -
Add
/typessubpath export to re-export types from@clerk/shared/typesalong with SDK-specific types. This allows importing Clerk types directly from the SDK package (e.g.,import type { UserResource } from '@clerk/react/types') without needing to install@clerk/typesas a separate dependency. (#7644) by @nikosdouvlis -
Add
HandleSSOCallbackcomponent which handles the SSO callback during custom flows, including support for sign-in-or-up. (#7678) by @dstaley -
Added new
createClerkClient()export from @clerk/chrome-extension/client (#7935) by @royangerimport { createClerkClient } from '@clerk/chrome-extension/client'; const publishableKey = process.env.CLERK_PUBLISHABLE_KEY; // Use createClerkClient in a popup or side panel const clerk = createClerkClient({ publishableKey }); // Use createClerkClient in a background service worker const clerk = await createClerkClient({ publishableKey: 'pk_...', background: true });
createClerkClient()from @clerk/chrome-extension/background is deprecated.
Patch Changes
-
Rename dev browser APIs to remove JWT terminology. The dev browser identifier is now a generic ID, so internal naming has been updated to reflect this. No runtime behavior changes. (#7930) by @brkalow
-
Add exports for
useWaitlisthook. (#7609) by @alexcarpenter -
Updated dependencies [
0a9cce3,e35960f,c438fa5,c438fa5,c576e5b,c9f0d77,93d568f,1bd1747,6a2ff9e,79bbbed,c438fa5,c438fa5,d2cee35,fa75344,0a9cce3,1dc705f,a374c18,7c0ff4a,466d642,5ef4a77,c51f843,04c6245,af85739,07f66f0,10b5bea,a168cb5,a05d130,19f34bf,bebb14c,b193f79,e9d2f2f,43fc7b7,76f548d,b7b00ac,899fb96,0b475c8,c86f5a3,c224a5c,7cbfd96,0cca492,0f1011a,cbc5618,38def4f,3ff86c4,7772f45,a3e689f,adb94a6,583f7a9,a630e1f,965e7f1,2b76081,b30383a, [f284c3d](f284c3d1d122b725594d0a...
@clerk/[email protected]
Major Changes
-
Remove deprecated verify methods in favor of
verify(). (#7927) by @wobsorianoapiKeys.verifySecret()removed// Before await clerkClient.apiKeys.verifySecret(secret); // After await clerkClient.apiKeys.verify(secret);
idpOAuthAccessToken.verifyAccessToken()removed// Before await clerkClient.idpOAuthAccessToken.verifyAccessToken(accessToken); // After await clerkClient.idpOAuthAccessToken.verify(accessToken);
m2m.verifyToken()removed// Before await clerkClient.m2m.verifyToken(params); // After await clerkClient.m2m.verify(params);
-
Update engines config to require node@20 or higher (#6931) by @jacekradko
-
Remove deprecated
samlAccountin favor ofenterpriseAccount(#7258) by @LauraBeatris
Minor Changes
-
Add support for Agent Tasks API endpoint which allows developers to create agent tasks that can be used to act on behalf of users through automated flows. (#7783) by @tmilewski
-
Add Frontend API proxy support via
frontendApiProxyoption inclerkMiddleware(#7602) by @brkalow -
Add
satelliteAutoSyncoption to optimize satellite app handshake behavior (#7597) by @nikosdouvlisSatellite apps currently trigger a handshake redirect on every first page load, even when no cookies exist. This creates unnecessary redirects to the primary domain for apps where most users aren't authenticated.
New option:
satelliteAutoSync(default:false)- When
false(default): Skip automatic handshake if no session cookies exist, only trigger after explicit sign-in action - When
true: Satellite apps automatically trigger handshake on first load (previous behavior)
New query parameter:
__clerk_sync__clerk_sync=1(NeedsSync): Triggers handshake after returning from primary sign-in__clerk_sync=2(Completed): Prevents re-sync loop after handshake completes
Backwards compatible: Still reads legacy
__clerk_synced=trueparameter.SSR redirect fix: Server-side redirects (e.g.,
redirectToSignIn()from middleware) now correctly add__clerk_sync=1to the return URL for satellite apps. This ensures the handshake is triggered when the user returns from sign-in on the primary domain.CSR redirect fix: Client-side redirects now add
__clerk_sync=1to all redirect URL variants (forceRedirectUrl,fallbackRedirectUrl) for satellite apps, not just the defaultredirectUrl.Usage
SSR (Next.js Middleware)
import { clerkMiddleware } from '@clerk/nextjs/server'; export default clerkMiddleware({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', // Set to true to automatically sync auth state on first load satelliteAutoSync: true, });
SSR (TanStack Start)
import { clerkMiddleware } from '@clerk/tanstack-react-start/server'; export default clerkMiddleware({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', // Set to true to automatically sync auth state on first load satelliteAutoSync: true, });
CSR (ClerkProvider)
<ClerkProvider publishableKey='pk_...' isSatellite={true} domain='satellite.example.com' signInUrl='https://primary.example.com/sign-in' // Set to true to automatically sync auth state on first load satelliteAutoSync={true} > {children} </ClerkProvider>
SSR (TanStack Start with callback)
import { clerkMiddleware } from '@clerk/tanstack-react-start/server'; // Options callback - receives context object, returns options export default clerkMiddleware(({ url }) => ({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', satelliteAutoSync: url.pathname.startsWith('/dashboard'), }));
Migration Guide
Behavior change:
satelliteAutoSyncdefaults tofalsePreviously, satellite apps would automatically trigger a handshake redirect on every first page load to sync authentication state with the primary domain—even when no session cookies existed. This caused unnecessary redirects to the primary domain for users who weren't authenticated.
The new default (
satelliteAutoSync: false) provides a better experience for end users. Performance-wise, the satellite app can be shown immediately without attempting to sync state first, which is the right behavior for most use cases.To preserve the previous behavior where visiting a satellite while already signed in on the primary domain automatically syncs your session, set
satelliteAutoSync: true:export default clerkMiddleware({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', satelliteAutoSync: true, // Opt-in to automatic sync on first load });
TanStack Start: Function props to options callback
The
clerkMiddlewarefunction no longer accepts individual props as functions. If you were using the function form for props likedomain,proxyUrl, orisSatellite, migrate to the options callback pattern.Before (prop function form - no longer supported):
import { clerkMiddleware } from '@clerk/tanstack-react-start/server'; export default clerkMiddleware({ isSatellite: true, // ❌ Function form for individual props no longer works domain: url => url.hostname, });
After (options callback form):
import { clerkMiddleware } from '@clerk/tanstack-react-start/server'; // ✅ Wrap entire options in a callback function export default clerkMiddleware(({ url }) => ({ isSatellite: true, domain: url.hostname, }));
The callback receives a context object with the
urlproperty (aURLinstance) and can return options synchronously or as a Promise for async configuration. - When
Patch Changes
-
Warn when a cookie-based session token is missing the
azpclaim instead of rejecting the token. This prepares consumers for a future version where theazpclaim will be required. (#7929) by @jacekradko -
Dropping the
__experimental_prefix fromsetPasswordCompromisedandunsetPasswordCompromisedand marking them as stable (#7504) by @octoper -
Added date filter parameters to user list endpoint (#7793) by @wobsoriano
-
Fixes an issue with host header parsing that would cause Clerk to throw an exception when receiving malformed host values. (#7370) by @brkalow
-
Improve token type validation in authentication requests (#7765) by @wobsoriano
-
Allow
nullforperiod_endinBillingSubscriptionItemWebhookEventJSON(#7699) by @jacekradko -
fix: Update getAuthData to use isMachineToken (#7755) by @jeremy-clerk
-
Allow usage of machine secret key when listing M2M tokens: (#7968) by @wobsoriano
const clerkClient = createClerkClient(); const m2mToken = await clerkClient.m2m.list({ machineSecretKey: 'ak_xxxxx', subject: machineId, });
-
Add missing fields to CommercePlan type. (#7707) by @dstaley
-
Updated dependencies [
0a9cce3,e35960f,c9f0d77,1bd1747,6a2ff9e,d2cee35,0a9cce3,a374c18,466d642,5ef4a77,af85739,10b5bea, [a05d130](https://github....
@clerk/[email protected]
Major Changes
-
Align experimental/unstable prefixes to use consistent naming: (#7361) by @brkalow
- Renamed all
__unstable_*methods to__internal_*(for internal APIs) - Renamed all
experimental__*andexperimental_*methods to__experimental_*(for beta features) - Removed deprecated billing-related props (
__unstable_manageBillingUrl,__unstable_manageBillingLabel,__unstable_manageBillingMembersLimit) andexperimental__forceOauthFirst
- Renamed all
-
Require Node.js 20.9.0 in all packages (#7262) by @jacekradko
-
Remove deprecated
asprop from unstyled button components (SignInButton,SignUpButton,SignOutButton,CheckoutButton,PlanDetailsButton,SubscriptionDetailsButton). Use theasChildprop with a custom element in the default slot instead. (#7839) by @wobsorianoBefore:
<SignInButton as='a' href='/sign-in' > Sign in </SignInButton>
After:
<SignInButton asChild> <a href='/sign-in'>Sign in</a> </SignInButton>
-
Remove
clerkJSUrl,clerkJSVersion,clerkUIUrl, andclerkUIVersionprops from all SDKs. To pin a specific version of@clerk/clerk-js, import theClerkconstructor from@clerk/clerk-jsand pass it toClerkProvidervia theClerkprop. To pin a specific version of@clerk/ui, importuifrom@clerk/uiand pass it via theuiprop. This bundles the modules directly with your application instead of loading them from the CDN. (#7879) by @jacekradko -
Introduce
<Show when={...}>as the cross-framework authorization control component and remove<Protect>,<SignedIn>, and<SignedOut>in favor of<Show>. (#7373) by @jacekradko -
Changed environment variable resolution order in
getContextEnvVar()to preferprocess.envoverimport.meta.env. Runtime environment variables (e.g., set in the Node.js adapter) now take precedence over build-time values statically replaced by Vite. This ensures that environment variables set at runtime behave as expected when deploying with the Astro Node adapter or similar runtime environments. (#7889) by @alexcarpenter
Minor Changes
-
Remove
clerkJSVariantoption and headless bundle. UseprefetchUI={false}instead. (#7629) by @jacekradko -
Introduce Keyless quickstart for Astro. This allows the Clerk SDK to be used without having to sign up and paste your keys manually. (#7812) by @wobsoriano
-
Add
uiprop toClerkProviderfor passing@clerk/ui(#7664) by @jacekradko -
Add standalone
getToken()function for retrieving session tokens outside of framework component trees. (#7325) by @bratsosThis function is safe to call from anywhere in the browser, such as API interceptors, data fetching layers (e.g., React Query, SWR), or vanilla JavaScript code. It automatically waits for Clerk to initialize before returning the token.
import { getToken } from '@clerk/nextjs'; // or any framework package
// Example: Axios interceptor
axios.interceptors.request.use(async (config) => {
const token = await getToken();
if (token) {
config.headers.Authorization =Bearer ${token};
}
return config;
}); -
Add
/typessubpath export to re-export types from@clerk/shared/typesalong with SDK-specific types. This allows importing Clerk types directly from the SDK package (e.g.,import type { UserResource } from '@clerk/react/types') without needing to install@clerk/typesas a separate dependency. (#7644) by @nikosdouvlis -
Introduce
<UNSAFE_PortalProvider>component which allows you to specify a custom container for Clerk floating UI elements (popovers, modals, tooltips, etc.) that use portals. Only Clerk components within the provider will be affected, components outside the provider will continue to use the default document.body for portals. (#7310) by @alexcarpenterThis is particularly useful when using Clerk components inside external UI libraries like Radix Dialog or React Aria Components, where portaled elements need to render within the dialog's container to remain interact-able.
'use client'; import { useRef } from 'react'; import * as Dialog from '@radix-ui/react-dialog'; import { UNSAFE_PortalProvider, UserButton } from '@clerk/nextjs'; export function UserDialog() { const containerRef = useRef<HTMLDivElement>(null); return ( <Dialog.Root> <Dialog.Trigger>Open Dialog</Dialog.Trigger> <Dialog.Portal> <Dialog.Overlay /> <Dialog.Content ref={containerRef}> <UNSAFE_PortalProvider getContainer={() => containerRef.current}> <UserButton /> </UNSAFE_PortalProvider> </Dialog.Content> </Dialog.Portal> </Dialog.Root> ); }
Patch Changes
-
Rename dev browser APIs to remove JWT terminology. The dev browser identifier is now a generic ID, so internal naming has been updated to reflect this. No runtime behavior changes. (#7930) by @brkalow
-
Wire
clerkUIVersionoption through all framework packages (#7740) by @nikosdouvlis -
Fix compatibility with Astro v6 Cloudflare adapter by using
cloudflare:workersenv whenlocals.runtime.envis unavailable (#7890) by @alexcarpenter -
Add
satelliteAutoSyncoption to optimize satellite app handshake behavior (#7597) by @nikosdouvlisSatellite apps currently trigger a handshake redirect on every first page load, even when no cookies exist. This creates unnecessary redirects to the primary domain for apps where most users aren't authenticated.
New option:
satelliteAutoSync(default:false)- When
false(default): Skip automatic handshake if no session cookies exist, only trigger after explicit sign-in action - When
true: Satellite apps automatically trigger handshake on first load (previous behavior)
New query parameter:
__clerk_sync__clerk_sync=1(NeedsSync): Triggers handshake after returning from primary sign-in__clerk_sync=2(Completed): Prevents re-sync loop after handshake completes
Backwards compatible: Still reads legacy
__clerk_synced=trueparameter.SSR redirect fix: Server-side redirects (e.g.,
redirectToSignIn()from middleware) now correctly add__clerk_sync=1to the return URL for satellite apps. This ensures the handshake is triggered when the user returns from sign-in on the primary domain.CSR redirect fix: Client-side redirects now add
__clerk_sync=1to all redirect URL variants (forceRedirectUrl,fallbackRedirectUrl) for satellite apps, not just the defaultredirectUrl.Usage
SSR (Next.js Middleware)
import { clerkMiddleware } from '@clerk/nextjs/server'; export default clerkMiddleware({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', // Set to true to automatically sync auth state on first load satelliteAutoSync: true, });
SSR (TanStack Start)
import { clerkMiddleware } from '@clerk/tanstack-react-start/server'; export default clerkMiddleware({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', // Set to true to automatically sync auth state on first load satelliteAutoSync: true, });
CSR (ClerkProvider)
<ClerkProvider publishableKey='pk_...' isSatellite={true} domain='satellite.example.com' signInUrl='https://primary.example.com/sign-in' // Set to true to automatically sync auth state on first load satelliteAutoSync={true} > {children} </ClerkProvider>
SSR (TanStack Start with callback)
import { clerkMiddleware } from '@clerk/tanstack-react-start/server'; // Options callback - receives context object, returns options export default clerkMiddleware(({ url }) => ({ isSatellite: true, domain: 'satellite.example.com', signInUrl: 'https://primary.example.com/sign-in', satelliteAutoSync: url.pathname.startsWith('/dashboard'), }));
Migration Guide
Behavior change:
satelliteAutoSyncdefaults tofalsePreviously, satellite apps would automatically trigger a handshake redirect on every fir...
- When
@clerk/[email protected]
Minor Changes
- Bump
@modelcontextprotocol/sdkfrom 1.7.0 to 1.25.2 to resolve security alerts (#7739) by @wobsoriano
Patch Changes
- Updated dependencies [
0a9cce3,e35960f,c9f0d77,1bd1747,6a2ff9e,d2cee35,44d0e5c,6ec5f08,0a9cce3,8c47111,00882e8,a374c18,466d642,5ef4a77,3abe9ed,af85739,10b5bea,a05d130,b193f79,e9d2f2f,6e90b7f,43fc7b7,0f1011a,cbc5618,38def4f,7772f45,a3e689f,583f7a9,965e7f1,84483c2,2b76081,f284c3d,ac34168,cf0d0dc,0aff70e,690280e,b971d0b,22d1689,e9a1d4d,c088dde,8902e21,972f6a0,a1aaff3,d85646a,ab3dd16,4a8cb10,fd195c1,8887fac,0b4b481,5f88dbb,dc886a9,428629b,8b95393,c438fa5,c438fa5,fd195c1,fd69edb,8d91225,1fc95e2,3dac245,a4c3b47,7c3c002,d8bbc66,3983cf8,f1f1d09,736314f,2cc7dbb,0af2e6f,86d2199,da415c8,97c9ab3,cc63aab,a7a38ab,cfa70ce,25d37b0,26254f0,c97e6af,5b24266,d98727e,79e2622,12b3070]:- @clerk/[email protected]
- @clerk/[email protected]