Spaces:
Runtime error
Runtime error
| import { BetterSqlite3Adapter } from "@lucia-auth/adapter-sqlite"; | |
| import { Lucia,TimeSpan } from "lucia"; | |
| import { getDB } from "./db.js"; | |
| import dotenv from "dotenv"; | |
| dotenv.config(); | |
| const db = getDB(); | |
| const adapter = new BetterSqlite3Adapter(db,{user:"users",session:"sessions"}); | |
| export const lucia = new Lucia(adapter, { | |
| sessionExpiresIn:new TimeSpan(10000,"m"), | |
| sessionCookie: { | |
| // expires:false, | |
| attributes: { | |
| // set to `true` when using HTTPS | |
| // secure: process.env.NODE_ENV === "production" | |
| secure: true, | |
| sameSite: "none", | |
| } | |
| }, | |
| getUserAttributes:(attributes)=>{ | |
| return { | |
| username:attributes.username, | |
| }; | |
| } | |
| }) | |
| declare module "lucia" { | |
| interface Register { | |
| Lucia:typeof lucia; | |
| DatabaseUserAttributes: RegisteredDatabaseUserAttributes; | |
| } | |
| } | |
| interface DatabaseUserAttributes{ | |
| username:string; | |
| } |