Skip to content
LogoLogo

Account.logout()

Clear authentication state (logout).

Type: static

Signature

static logout(apiKey?: string, storage?: SyncStorage): void

Parameters

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:

  1. Removes the authenticated address from storage
  2. Clears the current credential ID association
  3. Does not remove stored passkey accounts (user can still login later)

After logout:

  • Account.getAuthenticatedAddress() returns null
  • Account.get() without credentialId will throw
  • Account.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