Open 55555-Jyeon opened 1 month ago
npm install lucia
import { Lucia } from "lucia"; const adapter = new BetterSQLite3Adapter(db); // your adapter export const lucia = new Lucia(adapter, { sessionCookie: { attributes: { // set to `true` when using HTTPS secure: process.env.NODE_ENV === "production" } } }); // IMPORTANT! declare module "lucia" { interface Register { Lucia: typeof lucia; } }
import { Lucia } from "lucia"; const lucia = new Lucia(new Adapter(db)); const session = await lucia.createSession(userId, {}); await lucia.validateSession(session.id);
🔗 documentation → https://lucia-auth.com/
1️⃣ installation
2️⃣ initialize Lucia