Skip to main content
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
Delegation AuthSig (Inner Auth Sig): A cryptographic attestation from the Lit Protocol nodes that authorizes your session key to perform operations on behalf of your PKP
1

Install the SDK

Run the following command to install the SDK and the required viem peer dependency:
npm i @lit-protocol/auth viem
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.
import { createAuthManager, storagePlugins } from "@lit-protocol/auth";

const authManager = createAuthManager({
  storage: storagePlugins.localStorage({
    appName: "my-app",
    networkName: "naga-dev",
  }),
});

Storage Options Comparison

Choose your storage plugin based on where your application runs and how you want to manage session data.
Storage TypePersistenceUse CaseEnvironment
localStorageSurvives page refresh & browser restartBest for most web apps - sessions persist across browser restarts without additional setupBrowser
localStorageNodeFile-based persistent storageIdeal for CLI tools, backend services, or automated scripts that need to maintain sessionsNode.js only
customDepends on implementationUse when you need centralized session management, enhanced security, multi-device sync, or database storageCustom