See the Auth Manager Reference API for more details on how to create an Auth Manager.
Overview & Key Concepts
The Auth Manager is responsible for managing authentication state and session persistence in your Lit Protocol application. It handles the storage and retrieval of authentication credentials, enabling users to maintain active sessions across page refreshes and application restarts without re-authenticating.What the Auth Manager Stores
When you authenticate with Lit Protocol, the Auth Manager caches critical authentication data locally: Session Key Pair: A temporary cryptographic key pair that represents your current session with Lit Protocol:- Public key - Shared with Lit nodes to identify your session
- Secret key (private key) - Kept securely in local storage, never transmitted
1
Install the SDK
Run the following command to install the SDK and the required
viem peer dependency:viem must be installed as a dependency because the Lit JS SDK does not bundle it.2
Choose Storage Plugin
Choose the appropriate storage plugin based on your environment and requirements, then create your Auth Manager instance.
Storage Options Comparison
Choose your storage plugin based on where your application runs and how you want to manage session data.| Storage Type | Persistence | Use Case | Environment |
|---|---|---|---|
| localStorage | Survives page refresh & browser restart | Best for most web apps - sessions persist across browser restarts without additional setup | Browser |
| localStorageNode | File-based persistent storage | Ideal for CLI tools, backend services, or automated scripts that need to maintain sessions | Node.js only |
| custom | Depends on implementation | Use when you need centralized session management, enhanced security, multi-device sync, or database storage | Custom |