Clerk Context Provider
Expo
import { ClerkAuthManager } from '@auth/clerk/expo'- ClerkAuthManager.next.tsx
- ClerkAuthManager.expo.tsx
- ClerkProvider.tsx
Universal wrapper around Clerk’s platform ClerkProvider: it reads ClerkAuthContext and renders whichever implementation ClerkAuthManager registered (@clerk/nextjs on web, @clerk/clerk-expo on Expo).
At the root, prefer ClerkAuthManager from @auth/clerk/next or @auth/clerk/expo — it sets context, runs SyncClerkUIStatics (for UserButton.* compound components), and wraps ClerkProvider. For nested trees you can still import ClerkProvider from @auth/clerk; it uses the same context.
Usage in Next.js
Use ClerkAuthManager from @auth/clerk/next in your root layout. Pass providerProps for afterSignOutUrl, appearance, and other Clerk Next options.
Do not pass clerkAuth (or any custom authContext) from a React Server Component as a prop — it contains functions and cannot be serialized. The default clerkAuth bundle is imported inside the client ClerkAuthManager.
import { ClerkAuthManager } from '@auth/clerk/next'
import Document from './Document'
import NextClientRootLayout from './NextClientRootLayout'
export default async function NextServerRootLayout({ children }: { children: React.ReactNode }) {
return (
<Document>
<ClerkAuthManager
providerProps={{
afterSignOutUrl: '/api/auth/sign-out?redirectUrl=/',
appearance: {
elements: {
userButtonTrigger: { padding: '0px' },
/* ... */
},
},
}}
>
<NextClientRootLayout>{children}</NextClientRootLayout>
</ClerkAuthManager>
</Document>
)
}NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY is set (ClerkAuthManager from @auth/clerk/next inside client providers).Usage in Expo
Wrap your app with ClerkAuthManager from @auth/clerk/expo at the root (see ExpoRootLayout).
import { ClerkAuthManager } from '@auth/clerk/expo'
export default function ExpoRootLayout() {
return (
<ClerkAuthManager>
<UniversalAppProviders>
{/* ... */}
</UniversalAppProviders>
</ClerkAuthManager>
)
}Optional: pass providerProps (same shape as Clerk Expo’s provider) if you need to forward props to the underlying provider.
Token Storage
On iOS and Android, expo-secure-store persists Clerk session tokens across restarts.
