@clerk/nextjs
7.10.2 · 17 Nov 2026MIT4.2M / weekRepositoryHomepagenpmAtom feed
7.10.7 is the newest release of 7.x.
In short
15 breaking7 removed1 security13 new8 fixed6 internal
- Breaking
Align experimental/unstable prefixes to use consistent naming:
- Breaking
Renamed all
__unstable_*methods to__internal_*(for internal APIs) - Breaking
Renamed all
experimental__*andexperimental_*methods to__experimental_*(for beta features) - Breaking
Renamed
__unstable_invokeMiddlewareOnAuthStateChangeto__internal_invokeMiddlewareOnAuthStateChange. - Breaking
useAuth().getTokenis no longerundefinedduring server-side rendering, it is a function and calling it will throw. - Breaking
If you are using
getToken === undefinedchecks to avoid calling it, know that it will now throw instead and you should catch and handle the error. - BreakingTo check
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. - BreakingTo check
A bug where
useAuthwould sometimes briefly return theinitialStaterather thanundefined
Security
2 advisories affect 7.0.0; 7.2.4 fixes them
- CriticalOfficial Clerk JavaScript SDKs: Middleware-based route protection bypassGHSA-vqx2-fgx2-5wq9 · 16 Apr 2026Fixed in 7.2.1
- HighClerk has an authorization bypass when combining organization, billing, or reverification checksGHSA-w24r-5266-9c3c · 30 Apr 2026Fixed in 7.2.4
Release note
Major Changes
- Breaking
Align experimental/unstable prefixes to use consistent naming:
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
- Breaking
Renamed
__unstable_invokeMiddlewareOnAuthStateChangeto__internal_invokeMiddlewareOnAuthStateChange. - Breaking
useAuth().getTokenis no longerundefinedduring server-side rendering, it is a function and calling it will throw.If you are only using
getTokeninuseEffect, event handlers or with non-suspenseful data fetching libraries, no change is necessary as these only trigger on the client.If you are using suspenseful data fetching libraries that do trigger during SSR, you likely have strategies in place to avoid calling
getTokenalready, since this has never been possible.If you are using
getToken === undefinedchecks to avoid calling it, know that it will now throw instead and you should catch and handle the error.
async function doThingWithToken(getToken: GetToken) { try { const token = await getToken(); // Use token } catch (error) { if (isClerkRuntimeError(error) && error.code === 'clerk_runtime_not_browser') { // Handle error } } }To access auth data server-side, see the
Authobject reference doc. - Breaking
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.Breaking changes:
Removes ability to pass in
initialAuthStatetouseAuthThis was added for internal use and is no longer needed
Instead pass in
initialStateto the<ClerkProvider>, ordynamicif using the Next packageSee your specific SDK documentation for more information on Server Rendering
Fixes:
A bug where
useAuthwould sometimes briefly return theinitialStaterather thanundefinedThis could in certain situations incorrectly lead to a brief
user: nullon the first page after signing in, indicating a signed out state
Hydration mismatches in certain rare scenarios where subtrees would suspend and hydrate only after
clerk-jshad loaded fully
- Breaking
Updating minimum version of Node to v20.9.0
- Breaking
Throw an error when an encryption key is missing when passing a secret key at runtime
clerkMiddleware(). To migrate, ensure your application specifies aCLERK_ENCRYPTION_KEYenvironment variable when passingsecretKeyas a runtime option. - Breaking
Return 401 instead of 404 for unauthenticated server action requests in
auth.protect() - Breaking
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. - Breaking
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. - Breaking
Introduce
<Show when={...}>as the cross-framework authorization control component and remove<Protect>,<SignedIn>, and<SignedOut>in favor of<Show>. - Breaking
getToken()now throwsClerkOfflineErrorinstead of returningnullwhen the client is offline.This 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; } - Breaking
Drop support for
next@13andnext@14since they have reached EOL. Now>= next@15.2.3is required.
Minor Changes
Add
unsafe_disableDevelopmentModeConsoleWarningoption to disable the development mode warning that's emitted to the console when Clerk is first loaded.Add Frontend API proxy support via
frontendApiProxyoption inclerkMiddlewareIntroducing
setup_mfasession task- Removed
Remove
clerkJSVariantoption and headless bundle. UseprefetchUI={false}instead. Add
uiprop toClerkProviderfor passing@clerk/uiAdd standalone
getToken()function for retrieving session tokens outside of framework component trees.This 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;
});Export
useOrganizationCreationDefaultshook to fetch suggested organization name and logo from default naming rulesAdd
/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.Add
HandleSSOCallbackcomponent which handles the SSO callback during custom flows, including support for sign-in-or-up.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.This 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
Fix an App Router navigation edge case where duplicate in-flight redirects to the same destination could leave Clerk's awaitable navigation pending indefinitely.
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.
Wire
clerkUIVersionoption through all framework packagesFixed an issue where the CSP nonce generated by
clerkMiddleware({ contentSecurityPolicy: { strict: true } })was not forwarded as a request header. Server components can now access the nonce viaheaders(), allowingClerkProviderand Next.js to apply it to<script>tags.Fix Turbopack compatibility for
uiprop by addingturbopackIgnoremagic comment alongsidewebpackIgnoreon the dynamic@clerk/ui/entryimport. This prevents both bundlers from statically resolving the optional dependency at build time.Fix
@clerk/ui/entrybare specifier failing in browser when usinguiprop with RSCAdd exports for
useWaitlisthook.- Security
Updating peerDependency for CVE-2025-55182
Fix race condition that could cause
__clerkSharedModules is not definederror when using the shared React UI variant.Add support for Next.js 16 cache components by improving error detection and providing helpful error messages when
auth()orcurrentUser()are called inside a"use cache"function.Add image CDNs to the
connect-srcContent Security Policy directiveUpdate getAuthData to use isMachineToken
Add
satelliteAutoSyncoption to optimize satellite app handshake behaviorSatellite 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 actionWhen
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)
```typescript
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)
```typescript
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)
```tsx
<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)
```typescript
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: satelliteAutoSync defaults to false
Previously, 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`:
```typescript
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 `clerkMiddleware` function no longer accepts individual props as functions. If you were using the function form for props like `domain`, `proxyUrl`, or `isSatellite`, migrate to the options callback pattern.
**Before (prop function form - no longer supported):**
```typescript
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):**
```typescript
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 `url` property (a `URL` instance) and can return options synchronously or as a Promise for async configuration.- Breaking
- Breaking
Use new
@clerk/reactpackage. - Breaking
Isolate nonce fetch in Suspense boundary for improved PPR support
- Breaking
Updated dependencies:
@clerk/shared@4.0.0
@clerk/react@6.0.0
@clerk/backend@3.0.0
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.