main lucia set

This commit is contained in:
Dan Mihailescu 2024-12-15 12:46:37 -05:00
parent c7e69b99f2
commit 4a251c1714

View file

@ -1,5 +1,4 @@
import { Lucia } from "lucia"; import { Lucia } from "lucia";
//import { dev } from "$app/env";
import { PrismaAdapter } from "@lucia-auth/adapter-prisma"; import { PrismaAdapter } from "@lucia-auth/adapter-prisma";
import { PrismaClient } from "@prisma/client"; import { PrismaClient } from "@prisma/client";
@ -9,7 +8,7 @@ const adapter = new PrismaAdapter(client.session, client.user)
export const auth = new Lucia(adapter, { export const auth = new Lucia(adapter, {
sessionCookie: { sessionCookie: {
attributes: { attributes: {
// secure: !dev // secure: process.env.NODE_ENV === "production"
} }
}, },
getUserAttributes: (attributes)=>{ getUserAttributes: (attributes)=>{
@ -19,4 +18,15 @@ export const auth = new Lucia(adapter, {
} }
}); });
declare module "lucia" {
interface Register {
Lucia: typeof Lucia;
DatabaseUserAttributes: DatabaseUserAttributes
}
}
interface DatabaseUserAttributes {
email: string
}
export type Auth = typeof auth; export type Auth = typeof auth;