Lucia Authentication #8

Merged
DanMihailescu merged 18 commits from undoPretty into master 2024-12-19 20:06:45 -05:00
Showing only changes of commit 4a251c1714 - Show all commits

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;