clerk/clerk-expo

Implémentez l'authentification Clerk pour les applications Expo et React Native en utilisant les motifs guidés par source @clerk/expo. Utilisez pour AuthView/UserButton préconstruits ou des flux d'authentification personnalisés basés sur des hooks.

Qu'est-ce que clerk-expo ?

Ce skill permet d'intégrer Clerk, une solution d'authentification moderne, dans des applications mobiles développées avec Expo et React Native. Il fournit des motifs de code prêts à l'emploi, guidés par la source @clerk/expo, pour accélérer la mise en place de l'authentification. Vous pouvez choisir d'utiliser des composants préconstruits comme `AuthView` ou `UserButton` pour une solution rapide, ou opter pour des flux personnalisés basés sur des hooks (`useAuth`, `useSignIn`, `useSignUp`) pour un contrôle plus fin. Le skill est conçu spécifiquement pour les projets React Native utilisant Expo ; il ne doit pas être employé pour des applications iOS/Android natives avec Swift/Kotlin ou pour des projets web traditionnels. Il suit les pratiques recommandées par Clerk, y compris la gestion des sessions, l'actualisation des jetons et la configuration du fournisseur d'authentification.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clerk/skills/tree/main/skills/clerk-expo

Installed? Explore more Développement et programmation skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

Que fait clerk-expo ?

Implémentez l'authentification Clerk pour les applications Expo et React Native en utilisant les motifs guidés par source @clerk/expo. Utilisez pour AuthView/UserButton préconstruits ou des flux d'authentification personnalisés basés sur des hooks. Ne pas utiliser pour les projets natifs iOS/Swift, natifs Android/Kotlin, ou les framework web.

npx expo install @clerk/clerk-expo
import { ClerkProvider, SignedIn, SignedOut } from '@clerk/clerk-expo';
import { SafeAreaView, Text } from 'react-native';

export default function App() {
  return (
    <ClerkProvider publishableKey={process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY}>
      <SafeAreaView>
        <SignedIn>
          <Text>Vous êtes connecté</Text>
        </SignedIn>
        <SignedOut>
          <Text>Vous n'êtes pas connecté</Text>
        </SignedOut>
      </SafeAreaView>
    </ClerkProvider>
  );
}

Authentification avec un hook personnalisé

import { useAuth, useUser } from '@clerk/clerk-expo';
import { Button, Text, View } from 'react-native';

export default function ProfileScreen() {
  const { isSignedIn, user } = useUser();
  const { signOut } = useAuth();

  if (!isSignedIn) {
    return <Text>Veuillez vous connecter</Text>;
  }

  return (
    <View>
      <Text>Bonjour, {user?.fullName}</Text>
      <Button title="Se déconnecter" onPress={() => signOut()} />
    </View>
  );
}

Écran de connexion

import { useSignIn } from '@clerk/clerk-expo';
import { Button, TextInput, View } from 'react-native';

export default function SignInScreen() {
  const { signIn, setActive, isLoaded } = useSignIn();
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const onSignInPress = async () => {
    if (!isLoaded) return;

    try {
      const completeSignIn = await signIn.create({
        identifier: email,
        password,
      });
      await setActive({ session: completeSignIn.createdSessionId });
    } catch (err) {
      console.error(err);
    }
  };

  return (
    <View>
      <TextInput onChangeText={setEmail} placeholder="Email..." />
      <TextInput onChangeText={setPassword} placeholder="Mot de passe..." secureTextEntry />
      <Button title="Connexion" onPress={onSignInPress} />
    </View>
  );
}

Écran d'inscription

import { useSignUp } from '@clerk/clerk-expo';
import { Button, TextInput, View } from 'react-native';

export default function SignUpScreen() {
  const { signUp, setActive, isLoaded } = useSignUp();
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const onSignUpPress = async () => {
    if (!isLoaded) return;

    try {
      await signUp.create({ emailAddress: email, password });
      await setActive({ session: signUp.createdSessionId });
    } catch (err) {
      console.error(err);
    }
  };

  return (
    <View>
      <TextInput onChangeText={setEmail} placeholder="Email..." />
      <TextInput onChangeText={setPassword} placeholder="Mot de passe..." secureTextEntry />
      <Button title="Inscription" onPress={onSignUpPress} />
    </View>
  );
}

Variables d'environnement

Créez un fichier .env à la racine de votre projet :

EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=votre_clé_publiable_clerk_ici

Référez-vous à dashboard.clerk.com pour obtenir votre clé publiable.

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

clerk/clerk

Clerk authentication router. Use when user asks about adding authentication, setting up Clerk, custom sign-in flows, Swift or native iOS auth, native Android auth, Next.js patterns, React patterns, Vue patterns, Nuxt patterns, Astro patterns, TanStack Start patterns, Expo patterns, React Router patterns, Chrome Extension patterns, organizations, billing, subscriptions, payments, pricing, plans, seat-based pricing, feature entitlements, syncing users, or testing. Automatically routes to the specific skill based on their task.

clerk/clerk-android

Implement Clerk authentication for native Android apps using Kotlin and Jetpack Compose with clerk-android source-guided patterns. Use for prebuilt AuthView/UserButton or custom API-driven auth flows. Do not use for Expo or React Native projects.

clerk/clerk-astro-patterns

Astro patterns with Clerk — middleware, SSR pages, island components, API routes, static vs SSR rendering. Triggers on: astro clerk, clerk astro middleware, astro protected page, clerk island component, astro API route auth, clerk astro SSR.

clerk/clerk-backend-api

Clerk Backend REST API explorer and executor. Browse tags, inspect endpoint schemas, and execute authenticated requests. Use when listing users, managing organizations, or calling any Clerk API endpoint.

clerk/clerk-billing

Clerk Billing for subscription management - render Clerk's PricingTable and in-app checkout drawer, configure subscription plans, seat-limit plans for B2B, feature entitlements with has(), and billing webhooks. Use for SaaS monetization, plan gating, checkout flows, trials, invoicing, and subscription lifecycle management.

clerk/clerk-chrome-extension-patterns

Chrome Extension auth with @clerk/chrome-extension -- popup/sidepanel setup, syncHost for OAuth/SAML via web app, createClerkClient for service workers and headless extensions, stable CRX ID. Triggers on: Chrome extension auth, Plasmo clerk, popup sign-in, syncHost, background service worker token, createClerkClient, headless extension.

clerk/clerk-custom-ui

Custom authentication flows and component appearance - hooks (useSignIn, useSignUp), themes, colors, fonts, CSS. Use for custom sign-in/sign-up flows, appearance styling, visual customization, branding.

clerk/clerk-expo-patterns

Expo / React Native patterns with Clerk — SecureStore token cache, OAuth deep linking, useAuth in native, Expo Router protected routes, push notifications with user context. Triggers on: expo clerk, clerk react native, SecureStore token cache, expo router auth, OAuth deep link clerk, mobile auth clerk.

clerk/clerk-nextjs-patterns

Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.

clerk/clerk-nuxt-patterns

Nuxt 3 auth patterns with @clerk/nuxt - middleware, composables, server API routes, SSR. Triggers on: Nuxt auth, useAuth composable, clerkMiddleware Nuxt, server API Clerk, Nuxt route protection.

clerk/clerk-orgs

Clerk Organizations for B2B SaaS - create multi-tenant apps with org switching, role-based access, verified domains, and enterprise SSO. Use for team workspaces, RBAC, org-based routing, member management.

clerk/clerk-react-patterns

React SPA auth patterns with @clerk/react for Vite/CRA - ClerkProvider setup, useAuth/useUser/useClerk hooks, React Router protected routes, custom sign-in flows. Triggers on: Vite Clerk setup, React Router auth, useAuth hook, protected route, custom sign-in form React.

clerk/clerk-react-router-patterns

React Router v7 patterns with Clerk — rootAuthLoader, getAuth in loaders, clerkMiddleware, protected routes, SSR user data, org switching. Triggers on: react-router auth, rootAuthLoader, getAuth loader, react-router protected route, loader authentication, SSR auth react-router.

clerk/clerk-setup

Add Clerk authentication to any project by following the official quickstart guides.

clerk/clerk-swift

Implement Clerk authentication for native Swift and iOS apps using ClerkKit and ClerkKitUI source-guided patterns. Use for prebuilt AuthView or custom native flows. Do not use for Expo or React Native projects.

clerk/clerk-tanstack-patterns

TanStack React Start auth patterns with @clerk/tanstack-react-start - createServerFn, beforeLoad guards, loaders, Vinxi server. Triggers on: TanStack auth, createServerFn clerk, beforeLoad protection, TanStack Start middleware.

clerk/clerk-testing

E2E testing for Clerk apps. Use with Playwright or Cypress for auth flow tests.

clerk/clerk-vue-patterns

Vue 3 patterns with Clerk — composables (useAuth, useUser, useClerk, useOrganization), Vue Router guards, Pinia auth store integration. Triggers on: vue clerk, useAuth vue, clerk composables, vue router clerk guard, pinia auth clerk. For Nuxt, use clerk-nuxt-patterns instead.

clerk/clerk-webhooks

Clerk webhooks for real-time events and data syncing. Verify with verifyWebhook from the framework-specific package. Handle user, session, organization, billing, and payment events. Build event-driven features like database sync, notifications, and integrations.

Skills associés