Account.logout()
Clear authentication state (logout).
Type: static
Signature
static logout(apiKey?: string, storage?: SyncStorage): voidParameters
apiKey
Type: string | undefined
API key for JAW services. This method only clears local storage, so the key is optional here.
storage
Type: SyncStorage | undefined
Optional custom storage. Defaults to localStorage in the browser and to an in-memory store elsewhere. Pass a persistent store in React Native.
Returns
void
Behavior
This method clears the current authentication state:
- Removes the authenticated address from storage
- Clears the current credential ID association
- Does not remove stored passkey accounts (user can still login later)
After logout:
Account.getAuthenticatedAddress()returnsnullAccount.get()without credentialId will throwAccount.getStoredAccounts()still returns all accounts
Example
import { Account } from '@jaw.id/core';
Account.logout('your-api-key');
console.log('Logged out');Important Notes
- Logout is local only - it doesn't affect the smart account
- Stored passkey accounts remain available for future login
- The user can still access their account by logging in again
Related
- Account.get() - Login to an account
- Account.getAuthenticatedAddress() - Check authentication status
- Account.getStoredAccounts() - List available accounts