Lucia Authentication #8
1 changed files with 12 additions and 2 deletions
14
lucia.ts
14
lucia.ts
|
|
@ -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;
|
||||||
Loading…
Add table
Reference in a new issue