Documentation Index
Fetch the complete documentation index at: https://docs.mobile-starter.amisi.ai/llms.txt
Use this file to discover all available pages before exploring further.
@amisi/auth
@amisi/auth provides an adapter-based authentication API.
Adapter model
- Adapters implement a shared
AuthAdaptercontract. - The active adapter is selected at runtime via
initializeAuth({ adapter, options }).
Initialize
Initialize once at app startup:AuthProvider
Wrap your app with theAuthProvider to provide authentication context throughout your app:
- Initializes the auth adapter
- Listens for session changes
- Provides auth state to all child components
- Handles sign in, sign up, and sign out operations
Hook usage
useAuthContext
Access authentication state and operations from the provider:Available properties
adapter: AuthAdapter | null- Current auth adaptersession: AuthSession | null- Current sessionuser: AuthUser | null- Current userloading: boolean- Loading stateisAuthenticated: boolean- Whether user is authenticatedsignIn: (params) => Promise<AuthSession | null>- Sign in methodsignUp: (params) => Promise<AuthSession | null>- Sign up methodsignOut: () => Promise<void>- Sign out methodgetAccessToken: () => Promise<string | null>- Get access tokenrefresh: () => Promise<void>- Refresh session
Hook alias usage
useAuth is an alias of useAuthContext and must be used inside AuthProvider: