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.

referencesprebuilt-components.md

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

Prebuilt native components (@clerk/expo/native)

The default "add auth" path. AuthView, UserButton, and UserProfileView render Clerk's native UI — SwiftUI on iOS, Jetpack Compose on Android — and handle every enabled auth strategy (password, OTP, social, MFA) with no flow code.

Canonical docs (fetch to re-verify if the installed SDK is newer than 3.6.x): https://clerk.com/docs/reference/expo/native-components/overview — plus auth-view, user-button, user-profile-view, theming pages alongside it

Status and requirements — tell the developer up front:

  • Beta. Works well, but flag it before a production rollout decision.
  • Requires a development build (npx expo run:ios / run:android). Not Expo Go, not web.
  • Requires the @clerk/expo config plugin and a prebuild (see setup.md).

Components

Import from @clerk/expo/native:

Component Renders Props
AuthView Sign-in/sign-up UI, inline (fills parent) mode?: 'signInOrUp' | 'signIn' | 'signUp' (default signInOrUp), isDismissible?: boolean (default true), onDismiss?: () => void
UserButton Avatar button that opens the native user profile —
UserProfileView Profile/account management, inline isDismissible?, onDismiss?, style?

These are the only public props. Do not invent event handlers (onAuthEvent, onSignIn, etc.) — react to auth state with useAuth() / useUser() instead. Verify props against node_modules/@clerk/expo/dist/native/*.d.ts for the installed version.

Canonical screen

The components render inline; the app owns presentation. The docs pattern presents AuthView in a React Native Modal:

// src/app/index.tsx
import { useAuth } from '@clerk/expo'
import { AuthView, UserButton } from '@clerk/expo/native'
import { useState } from 'react'
import { View, ActivityIndicator, Button, Modal } from 'react-native'

export default function MainScreen() {
  const { isSignedIn, isLoaded } = useAuth({ treatPendingAsSignedOut: false })
  const [isAuthOpen, setIsAuthOpen] = useState(false)

  if (!isLoaded) return <ActivityIndicator size="large" />

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      {isSignedIn ? <UserButton /> : <Button title="Sign in" onPress={() => setIsAuthOpen(true)} />}
      <Modal
        animationType="slide"
        visible={isAuthOpen}
        presentationStyle="pageSheet"
        onRequestClose={() => setIsAuthOpen(false)}
      >
        <AuthView onDismiss={() => setIsAuthOpen(false)} />
      </Modal>
    </View>
  )
}

Rules baked into this pattern:

  1. useAuth({ treatPendingAsSignedOut: false }) — required with native components so pending session tasks aren't treated as signed out mid-flow.
  2. Keep the Modal mounted at the same level as signed-in and signed-out content. Rendering it only inside signed-out content unmounts it too early when auth state flips before session tasks finish.
  3. Session sync is automatic. When AuthView completes, the JS SDK's useAuth()/useUser() update on their own. Never call setActive() and never add manual session plumbing.
  4. Keep mode at its default (signInOrUp) unless the developer asks for separate flows.
  5. Don't add useSignInWithGoogle() / useSignInWithApple() buttons next to AuthView — it renders every enabled social provider itself. Provider availability comes from the instance config; fix gaps in the Clerk Dashboard, not in code.

Theming

The config plugin accepts a JSON theme applied to both platforms at prebuild:

// app.json
{
  "expo": {
    "plugins": [["@clerk/expo", { "theme": "./clerk-theme.json" }]]
  }
}
// clerk-theme.json — every key optional; unknown keys warn
{
  "colors": { "primary": "#6C47FF", "background": "#FFFFFF" },
  "darkColors": { "primary": "#8B6FFF", "background": "#0B0B0F" },
  "design": { "borderRadius": 12, "fontFamily": "Inter" }
}

Colors are 6- or 8-digit hex (validated at prebuild — invalid values fail the build with a descriptive error). Available color keys: primary, background, input, danger, success, warning, foreground, mutedForeground, primaryForeground, inputForeground, neutral, border, ring, muted, shadow. Rerun npx expo prebuild --clean (or expo run:*) after theme changes.

For customization beyond the theme schema, the answer is custom flows, not fighting the native UI.

Verification checklist

  • Dev build runs on device/simulator (not Expo Go); developer told about beta status.
  • Provider + token cache per setup.md; config plugin registered; prebuild done.
  • treatPendingAsSignedOut: false passed to the useAuth() call gating the auth UI.
  • Auth modal mounted outside the signed-in/signed-out branch.
  • No setActive(), no onAuthEvent, no native Google/Apple hooks alongside AuthView.
  • One real sign-in completed; useUser() reflects the user; session survives app restart.

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.