All skills
clerk avatar

/clerk-expo

@3d0c898 official
by clerkclerk/skills83 stars
5

Add Clerk authentication to Expo and React Native apps using @clerk/expo. Use for Expo setup, prebuilt native components (AuthView, UserButton), custom sign-in/sign-up flows (email, password, SMS/phone OTP, MFA), OAuth/SSO, native Google/Apple sign-in, Expo Router protected routes, biometrics, and push notifications. Do not use for native Swift/iOS, native Android/Kotlin, or web-only framework projects.

Use this Skill: https://skilld.dev/gh/clerk/skills/clerk-expo

This session only. Nothing lands on disk.

referencessetup.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Setup: install, provider, token cache, builds

Shared prerequisites for every path (prebuilt or custom). Complete this file top to bottom before implementing a flow.

Canonical doc (fetch to re-verify if the installed SDK is newer than 3.6.x): https://clerk.com/docs/getting-started/quickstart (Expo SDK tab)

Supported versions

Written against @clerk/expo v3.6.x (July 2026). Peer requirements: Expo SDK 53–56, React Native ≥ 0.75, React 18 or 19. If the project's Expo SDK or RN version is below the floor, upgrading the app comes before adding Clerk.

1. Install

npx expo install @clerk/expo expo-secure-store
# add expo-dev-client if the app will use native components or native sign-in hooks
npx expo install expo-dev-client

npx expo install (not npm install) ensures Expo-SDK-compatible versions. Additional peer deps are per-strategy — install only what the selected flow needs:

Feature Install
Browser SSO/OAuth (useSSO) npx expo install expo-auth-session expo-web-browser
Native Google sign-in npx expo install expo-crypto
Native Apple sign-in npx expo install expo-apple-authentication
Biometrics (useLocalCredentials) npx expo install expo-local-authentication
Passkeys npx expo install @clerk/expo-passkeys

Alternative bootstrap: npx clerk@latest init --framework expo installs @clerk/expo and writes the publishable key to the env file (it does not scaffold screens).

2. Publishable key

.env at the project root:

EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...

Rules:

  • The prefix must be EXPO_PUBLIC_ — Metro only inlines env vars with this prefix into the client bundle.
  • Read the variable in app code and pass it explicitly to ClerkProvider. Env reads inside node_modules are not inlined in production builds.
  • If no key is available, ask the developer (Clerk Dashboard → API keys) and wait.

3. Dashboard prerequisites

  • Native API enabled: Clerk Dashboard → Native applications (https://dashboard.clerk.com/~/native-applications). Required for native apps to talk to Clerk.
  • The auth strategies the app will use (email, phone/SMS, social providers) are enabled under User & authentication.

4. Config plugin

Verify app.json / app.config.js includes both plugins (npx expo install usually adds them):

{
  "expo": {
    "plugins": ["expo-secure-store", "@clerk/expo"]
  }
}

The @clerk/expo plugin registers the native modules (iOS min deployment target 17.0), wires Google sign-in when configured, and optionally accepts a theme option for native components (see prebuilt-components.md). Plugin changes require a fresh prebuild: npx expo prebuild --clean or rerunning expo run:*.

Apps using browser SSO also need a deep-link scheme in app.json: "scheme": "yourapp".

5. ClerkProvider + token cache

Root layout (Expo Router):

// src/app/_layout.tsx
import { ClerkProvider } from '@clerk/expo'
import { tokenCache } from '@clerk/expo/token-cache'
import { Slot } from 'expo-router'

const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!

if (!publishableKey) {
  throw new Error('Add your Clerk Publishable Key to the .env file')
}

export default function RootLayout() {
  return (
    <ClerkProvider publishableKey={publishableKey} tokenCache={tokenCache}>
      <Slot />
    </ClerkProvider>
  )
}
  • tokenCache persists the session in the device keychain via expo-secure-store (AFTER_FIRST_UNLOCK), so sessions survive app restarts. Without it, tokens live in memory only.
  • On web, tokenCache is undefined and Clerk falls back to its web storage — no platform branching needed.
  • Only implement a custom TokenCache if the developer has a stated requirement (e.g. different keychain accessibility). Never AsyncStorage — it is unencrypted.
  • ClerkProvider calls WebBrowser.maybeCompleteAuthSession() internally; never add it manually.
  • Do not add provider props that match defaults.

6. Expo Go vs development build vs web

Capability Expo Go Dev build Web
Custom flows (useSignIn, useSignUp, hooks) Yes Yes Yes
Browser SSO (useSSO) Yes Yes Yes
Native components (@clerk/expo/native) No Yes No
Native Google/Apple hooks No Yes No
Biometrics, passkeys No Yes No
Web UI components (@clerk/expo/web) — — Yes

Dev build commands: npx expo run:ios / npx expo run:android (or EAS Build). State this requirement before implementing anything in the "No under Expo Go" rows.

For Expo web targets, @clerk/expo/web exports the standard Clerk web components (SignIn, SignUp, UserButton, UserProfile, OrganizationSwitcher, PricingTable, …); they throw if rendered on native, so gate on Platform.OS === 'web'.

7. Verify setup before building flows

  • App boots with the provider mounted and no key errors.
  • useAuth() returns isLoaded: true shortly after launch.
  • After the first real sign-in later: kill and relaunch the app — the session must persist.

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The analyzed skill defines safe, verified integration patterns for the @clerk/expo authentication library in Expo and React Native applications. It appropriately specifies standard secret management guidelines (storing publishable keys in environment files rather than hardcoding them) and does not exhibit any malicious behaviors such as data exfiltration, prompt injection, or obfuscation.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

Signed by skilld at 3d0c898. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
What it can do
Network
metadata
{
  "author": "clerk",
  "version": "2.0.0"
}
All 1 allowed tools
WebFetch
Other metadata
compatibility
Requires @clerk/expo v3.4+ (written against v3.6.x, July 2026). Expo SDK 53-56, React Native 0.75+.

README badge

README badge for clerk/skills/clerk-expo

Implements Clerk authentication in Expo and React Native projects using @clerk/expo, supporting either prebuilt AuthView/UserButton components or custom hook-driven flows. Handles ClerkProvider setup, token persistence, native sign-in strategies, and Expo config plugin registration—excludes native iOS/Swift, native Android/Kotlin, and web-only frameworks.

Generated from the current SKILL.md.

Does this skill work with native iOS/Swift or native Android/Kotlin projects?
No. This skill is for Expo and React Native only. Native iOS/Swift and native Android/Kotlin projects should use their respective Clerk SDKs, not this skill.
Do I need a development build or can I use Expo Go?
Native components like AuthView and UserButton require an iOS/Android development build. Expo Go does not support native modules. For web targets, use the @clerk/expo/web exports instead.
What's the difference between prebuilt and custom flows?
Prebuilt uses Clerk's AuthView or UserButton components for the fastest setup. Custom hook-driven flows give you full control over the UI and authentication state but require more implementation work.
Do I need to set the publishable key via environment variables?
No. Pass the publishable key directly to <ClerkProvider publishableKey={key}> unless you explicitly ask for environment-variable indirection. The skill will not introduce env-var wiring by default.
Does this skill cover Expo-specific recipes like token caching and protected routes?
This skill covers flow selection and end-to-end setup. Expo-specific recipes (SecureStore token cache, OAuth deep-link configuration, Expo Router protected routes) are in the clerk-expo-patterns skill instead.

Generated from the current SKILL.md. These answers refresh after source changes.