Mobile authentication patterns with Clerk, Supabase, and custom auth including biometrics, secure storage, and social login. Use when implementing authentication, managing tokens, or setting up biometric unlock.
View on GitHubvanman2024/ai-dev-marketplace
mobile
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/vanman2024/ai-dev-marketplace/blob/main/plugins/mobile/skills/mobile-auth-patterns/SKILL.md -a claude-code --skill mobile-auth-patternsInstallation paths:
.claude/skills/mobile-auth-patterns/# Mobile Auth Patterns
Comprehensive skill for implementing authentication in React Native/Expo mobile apps.
## Overview
Mobile authentication requires special considerations:
- Secure token storage (not AsyncStorage)
- Biometric authentication for quick access
- Social login providers (Apple, Google)
- Session management across app states
- Refresh token handling
## Use When
This skill is automatically invoked when:
- Setting up authentication flows
- Implementing biometric unlock
- Integrating social login providers
- Managing secure token storage
- Handling session persistence
## Auth Provider Templates
### Clerk Integration
```typescript
// providers/ClerkProvider.tsx
import { ClerkProvider, useAuth } from '@clerk/clerk-expo';
import * as SecureStore from 'expo-secure-store';
const tokenCache = {
async getToken(key: string) {
return await SecureStore.getItemAsync(key);
},
async saveToken(key: string, value: string) {
await SecureStore.setItemAsync(key, value);
},
async clearToken(key: string) {
await SecureStore.deleteItemAsync(key);
},
};
export function AuthProvider({ children }: { children: React.ReactNode }) {
const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!;
return (
<ClerkProvider publishableKey={publishableKey} tokenCache={tokenCache}>
{children}
</ClerkProvider>
);
}
// hooks/useAuthenticatedUser.ts
import { useUser, useAuth } from '@clerk/clerk-expo';
export function useAuthenticatedUser() {
const { user, isLoaded } = useUser();
const { isSignedIn, signOut, getToken } = useAuth();
return {
user,
isLoaded,
isSignedIn,
signOut,
getToken,
fullName: user?.fullName,
email: user?.primaryEmailAddress?.emailAddress,
avatar: user?.imageUrl,
};
}
```
### Supabase Auth
```typescript
// lib/supabase.ts
import 'react-native-url-polyfill/auto';
import { createClient } from '@supabase/supabase-js';
import * as SecureStore from 'expo-secure-store';