TheDocumentation Index
Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
Use this file to discover all available pages before exploring further.
anonymousAuth plugin creates a lightweight guest identity on demand. The guest gets a real session and can use your app fully. When they decide to register, their data migrates to the new account without any loss.
Setup
lib/kavach.ts
Create guest
POST /auth/anonymous
Creates a new anonymous user and returns a session. No request body needed.
Create guest (client)
user.isAnonymous is true and the email and name fields are null.
Upgrade to real account
POST /auth/anonymous/upgrade
Requires an active anonymous session. Converts the guest to a permanent user. The session stays active, the user ID does not change.
Upgrade guest (client)
user.isAnonymous becomes false and the account is treated the same as one registered normally. If emailPassword is also active, the email-verification flow applies.
Error codes
| Code | Status | Meaning |
|---|---|---|
EMAIL_TAKEN | 409 | Email already registered to another account |
NOT_ANONYMOUS | 400 | The session belongs to a non-guest user |
Guest cleanup
Expired anonymous accounts can accumulate. Schedule regular cleanup with the built-in helper:Scheduled cleanup
Configuration reference
How long an anonymous session lasts before expiring, in seconds.
Whether guests can convert to real accounts via the upgrade endpoint.