fjrg2007/enigma/clerk-expo-patterns

Claude Code and agent skill by fjrg2007/enigma

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

'Expo / React Native patterns with Clerk — SecureStore token cache, OAuth

Install

npx vskill@latest install fjrg2007/enigma/clerk-expo-patterns

SKILL.md

The same SKILL.md was published earlier as ai-integr8tor/midudev-autoskills/clerk-expo-patterns.

Expo Patterns

SDK: @clerk/expo v3+. Requires Expo 53+, React Native 0.73+.

What Do You Need?

TaskReference
Persist tokens with SecureStorereferences/token-storage.md
OAuth (Google, Apple, GitHub)references/oauth-deep-linking.md
Protected screens with Expo Routerreferences/protected-routes.md
Push notifications with user datareferences/push-notifications.md

Mental Model

Clerk stores the session token in memory by default. In native apps:

  • SecureStore — encrypt token in device keychain (recommended for production)
  • `tokenCache` — prop on <ClerkProvider> that provides custom storage
  • `useAuth` — same API as web, works in any component
  • OAuth — requires useSSO + deep link scheme configured in app.json

Minimal Setup

app/_layout.tsx
tsx
import { ClerkProvider } from '@clerk/expo'
import { tokenCache } from '@clerk/expo/token-cache'
import { Stack } from 'expo-router'
const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!
export default function RootLayout() {
return (
<ClerkProvider publishableKey={publishableKey} tokenCache={tokenCache}>
<Stack />
</ClerkProvider>
)
}
CRITICAL: Use EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY — not NEXT_PUBLIC_. Env vars inside node_modules are not inlined in production builds. Always pass publishableKey explicitly.

Built-in Token Cache

tsx
import { tokenCache } from '@clerk/expo/token-cache'

This uses expo-secure-store with keychainAccessible: AFTER_FIRST_UNLOCK. Install the peer dep:

bash
npx expo install expo-secure-store

Auth Hooks

tsx
import { useAuth, useUser, useSignIn, useSignUp, useClerk } from '@clerk/expo'
export function ProfileScreen() {
const { isSignedIn, userId, signOut } = useAuth()
const { user } = useUser()
if (!isSignedIn) return <Redirect href="/sign-in" />
return (
<View>
<Text>{user?.fullName}</Text>
<Button title="Sign Out" onPress={() => signOut()} />
</View>
)
}

OAuth Flow (Google)

tsx
import { useSSO } from '@clerk/expo'
import * as WebBrowser from 'expo-web-browser'
WebBrowser.maybeCompleteAuthSession()
export function GoogleSignIn() {
const { startSSOFlow } = useSSO()
const handlePress = async () => {
try {
const { createdSessionId, setActive } = await startSSOFlow({
strategy: 'oauth_google',
redirectUrl: 'myapp://oauth-callback',
})
if (createdSessionId) await setActive!({ session: createdSessionId })
} catch (err) {
console.error(err)
}
}
return <Button title="Continue with Google" onPress={handlePress} />
}

Org Switching

tsx
import { useOrganization, useOrganizationList } from '@clerk/expo'
export function OrgSwitcher() {
const { organization } = useOrganization()
const { setActive, userMemberships } = useOrganizationList()
return (
<View>
<Text>Current: {organization?.name ?? 'Personal'}</Text>
{userMemberships.data?.map(mem => (
<Button
key={mem.organization.id}
title={mem.organization.name}
onPress={() => setActive({ organization: mem.organization.id })}
/>
))}
</View>
)
}

Common Pitfalls

SymptomCauseFix
publishableKey undefined in prodUsing env var without EXPO_PUBLIC_Rename to EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY
Token lost on app restartNo tokenCachePass tokenCache from @clerk/expo/token-cache
OAuth redirect not workingMissing scheme in app.jsonAdd "scheme": "myapp" to app.json
WebBrowser.maybeCompleteAuthSessionNot calledCall it at the top level of the OAuth callback screen
useSSO not foundOld @clerk/expo versionuseSSO replaced useOAuth in v3+

Import Map

WhatImport From
ClerkProvider@clerk/expo
tokenCache@clerk/expo/token-cache
useAuth, useUser, useSignIn@clerk/expo
useSSO@clerk/expo
useOrganization, useOrganizationList@clerk/expo

See Also

  • clerk-setup - Initial Clerk install
  • clerk-custom-ui - Custom flows & appearance
  • clerk-orgs - B2B organizations

Docs

Expo SDK

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/fjrg2007/enigma/clerk-expo-patterns/badge)](https://verified-skill.com/skills/fjrg2007/enigma/clerk-expo-patterns)

Something wrong with this skill or its page? Tell us.