💰 Need Test Tokens? Visit the Chronicle Yellowstone
Faucet to get test tokens
for your EOA account.
Overview
The Lit Protocol Auth Services package helps you run the infrastructure required to mint Programmable Key Pairs (PKPs) and power OAuth-based sign-in flows.Auth Service: Handles PKP minting for supported auth methods and exposes APIs consumed by the Lit JS SDK.Login Server: Manages OAuth flows (Google, Discord, etc.) and issues short-lived session tokens that the Auth Service consumes.
Hosted Auth Services
Lit hosts default Auth Service instances so you can build without deploying infrastructure on day one. Point your application to the URL that matches the network you’re targeting:- Naga Dev
- Naga Test
- Naga Mainnet
- Auth Service URL
- Login Server
- Usage: Use Lit’s hosted endpoints while you prototype. Configure your SDK or environment variables with these URLs.
The hosted services are best suited for prototyping. Self-host the Auth
Service and Login Server for production traffic or when you need custom
configuration.
Payment Delegation APIs
The Auth Service also exposes lightweight endpoints that sponsor user requests on the network. These are the same APIs the Lit SDK calls when you uselitClient.authService.registerPayer / delegateUsers from the Payment Manager guide.
POST /register-payer- Headers:
x-api-key. - Behaviour: generates a random
payerSecretKey, hashes it with the API key, and derives a child wallet fromLIT_DELEGATION_ROOT_MNEMONIC. - Response:
{ success, payerWalletAddress, payerSecretKey }. The service does not persist the secret—you must store it securely (KMS, vault, etc.). - Rotation: call the endpoint again with the same API key to rotate the secret and derive a new child wallet.
- Headers:
POST /add-users- Headers:
x-api-key,payer-secret-key; body is a JSON array of user addresses. - Behaviour: recomputes the same child wallet on the fly and calls
PaymentManager.delegatePaymentsBatchso the payer sponsors those users.
- Headers:
Running the Auth Service yourself keeps the derivation mnemonic and payer secrets inside your infrastructure. The Lit-hosted instance is great for quick starts, but you remain responsible for storing the returned
payerSecretKey.paymentManager.delegatePayments* directly from your backend. See Payment Manager Setup for sample code.
Install the SDK
Run the following command to install the SDK:Lit Auth Service
Choose how to run:- One-click Deploy (Railway)
- Container image (Docker)
- Use the package (Node.js)
One-click Deploy (Railway)
Container image
Use the package (Node.js)
1
Create the Lit Auth Service
Create the Lit Auth Service instance.
2
Start the background worker
3
Setup environment variables
Setup the environment variables.
Lit Login Server
Prerequisites
- Google OAuth 2.0 (Web) client ID and client secret. Use the official guide: Get your Google API client ID.
- Discord application client ID and client secret. Follow the official guide: Discord OAuth2.
You should set the callback/redirect URLs to the same domain as the Login
Server e.g.
One-click Deploy (Railway)
Container image
Use the package (Node.js)
1
Create the Lit Login Server
Create the Lit Login Server instance.
2
Setup environment variables
When you run a custom Login Server, the
DISCORD_CLIENT_ID is embedded into the authMethodId that Lit nodes use to locate the correct PKP. Make sure the value matches the client ID you used when minting the Discord auth method.