Global authentication context
Wrap the application entry point so authentication state is available to Clerk hooks and components throughout the component tree.
Clerk · Type Alias
ClerkProviderProps is the props type accepted by ClerkProvider. It configures Clerk's application-wide authentication context, redirects, appearance, navigation, and integration-specific behavior.
ClerkProviderProps describes the props accepted by ClerkProvider. The provider supplies session and user context to Clerk hooks and components, and its options configure redirects, appearance, routing, navigation, satellite domains, proxying, and other application behavior.
type ClerkProviderProps = { ... }| Name | Type | Description |
|---|---|---|
props | ClerkProviderProps | Optional provider configuration, including appearance, redirect destinations, allowed origins, routing, navigation, satellite, and proxy settings. |
A React provider component that supplies Clerk session and user context to descendant hooks and components.
import { ClerkProvider } from '@clerk/react'
export function App() {
return (
<ClerkProvider
signInFallbackRedirectUrl="/dashboard"
signUpFallbackRedirectUrl="/dashboard"
>
<MainApp />
</ClerkProvider>
)
}Wrap the application at its entry point and configure fallback destinations for sign-in and sign-up.
Wrap the application entry point so authentication state is available to Clerk hooks and components throughout the component tree.
Set fallback destinations for sign-in, sign-up, or sign-out when no more specific redirect is present.
Apply shared styling to Clerk Components from the provider.
Configure custom push and replace navigation behavior for an integrated router.
ClerkProviderProps is the props type for ClerkProvider. ClerkProvider should normally wrap the entire application at its entry point so Clerk hooks and components can access session and user context.
Follow-up: Why wrap the whole application instead of only protected routes? A global provider makes authentication context available consistently throughout the application.
The redirect fallback props are used when a sign-in or sign-up URL does not already contain a redirect_url. Clerk recommends environment variables instead when possible.
Follow-up: What happens when a redirect origin is not allowed? Clerk treats the redirect as unsafe, uses the default redirect, and logs a console warning.
The provider accepts an appearance object for styling Clerk Components, but that styling does not affect Account Portal pages. It also supports navigation-related configuration such as routerPush and routerReplace.
Follow-up: How did Core 2 change custom navigation? The former navigate prop was replaced by separate routerPush and routerReplace props so push and replace behavior can be customized independently.
ClerkProviderappearanceafterSignOutUrlallowedRedirectOriginsrouterPushrouterReplacesignInFallbackRedirectUrlsignUpFallbackRedirectUrl