Lit Explorer Naga is an application that allows you to authenticate with Lit Protocol using the native Lit auth methods.
- Add a new file in
src/lit-action-examples/entries/
that default-exports aLitActionExample
. Theid
must be unique. - Use
String.raw
to define multiline snippets, e.g.const code = String.raw\`...\`;
and fill intitle
, optionaldescription
,order
, and any defaultjsParams
. - The registry auto-loads every file in that directory, so your example will appear in the Lit Action editor once you save and refresh the app.
- Prefer small, focused samples that demonstrate a single concept; link to docs inside the description if extra context is needed.
- You are considered "logged-in" when both a PKP and an auth context exist in state.
After authenticating with a method (Google, Discord, WebAuthn, EOA, Stytch, Custom), either:
- You select an existing PKP in the PKP selection section
- You mint a new PKP and immediately create
authContext
, then setuser
The <LitAuthProvider />
does not redirect on successful login. It simply closes the modal once user is set and isAuthenticated becomes true.
The dashboard is always the index route for /
, and it conditionally renders based on auth state from context. When the user logs in, React re-renders the same component with different UI.
Inside LoggedInDashboard
, it reads user from useLitAuth()
. If there’s no user, it shows a sign-in experience and, in popup mode, auto-opens the modal.