Better Auth integration with Expo/React Native. Use when working on mobile authentication, session management, or debugging auth issues in the mobile app. Triggers on "mobile auth", "expo auth", "better-auth expo", "session provider", "SecureStore", or when editing apps/frontend/mobile auth files.
The mobile app uses Better Auth with @better-auth/expo plugin.
Better Auth's session state doesn't sync reliably with React context on Expo. The plugin stores cookies in expo-secure-store, but reactive session updates don't propagate as expected.
Custom SessionProvider that:
$sessionSignal for auth state changesonAuthSuccess() after sign-in/sign-up// src/lib/auth.ts
export function getCachedSession(): AuthSession | null {
const raw = SecureStore.getItem(SESSION_DATA_KEY);
// validate and return
}
// src/providers/session-provider.tsx
useEffect(() => {
const store = getAuthClient().$store;
const sessionSignal = store.atoms.$sessionSignal;
const unsubscribe = sessionSignal.subscribe(() => {
setData(getCachedSession());
});
return () => unsubscribe();
}, []);
| Config | Value | Notes |
|--------|-------|-------|
| cookiePrefix | yourcompany | Must match backend's advanced.cookiePrefix |
| scheme | mobile | Must match scheme in app.json |
| storagePrefix | mobile | Prefix for device storage keys |
apps/frontend/mobile/src/lib/auth.tsapps/frontend/mobile/src/providers/session-provider.tsxapps/backend/api/src/auth.tsexpiresAt from cached data$sessionSignal subscription is undocumented API and may change| Issue | Check |
|-------|-------|
| Session not updating | Verify onAuthSuccess() called after sign-in |
| Cookie mismatch | Compare cookiePrefix between mobile and backend |
| Auth redirect fails | Check scheme matches app.json |
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer