Architecture
Each signed-in account is stored in the Reduxaccounts map, keyed by user ID. The map persists to localStorage (web) or platform-specific secure storage (React Native). The activeAccountId field tracks which account is currently active.
When the user switches accounts, the SDK restores the stored refresh token for the target account and fetches a new access token automatically.
Hooks
| Hook | Purpose |
|---|---|
useAccounts | Read the list of accounts and the active account |
useAddAccount | Clear current auth state to allow signing into a new account |
useSwitchAccount | Switch the active session to a different stored account |
useRemoveAccount | Sign out and remove one account from the stored list |
useSignOutAll | Sign out all accounts simultaneously |
Reading Account State
accounts is an AccountSummary containing id, name, email, and avatar.
Adding a New Account
CallingaddAccount clears the current auth state, which causes the app to display the sign-in UI. The previously stored accounts remain in the accounts map and are not affected. After the user signs in to the new account, it is added to the map automatically.
canAddAccount is false when the maximum of 5 accounts is already stored.
Switching Accounts
Removing an Account
Signing Out All Accounts
signOutAll sends a sign-out request for every stored account’s refresh token (best-effort) and clears all local auth state.

