Lucia Authentication #8
5 changed files with 7797 additions and 25 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
12
lucia.ts
Normal file
12
lucia.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { Lucia } from "lucia";
|
||||
import { PrismaAdapter } from "@lucia-auth/adapter-prisma";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const client = new PrismaClient();
|
||||
const adapter = new PrismaAdapter(client.session, client.user)
|
||||
// expect error (see next section)
|
||||
export const auth = new Lucia({
|
||||
|
||||
});
|
||||
|
||||
export type Auth = typeof auth;
|
||||
7795
package-lock.json
generated
7795
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -50,14 +50,17 @@
|
|||
"vitest": "^2.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lucia-auth/adapter-prisma": "^4.0.1",
|
||||
"@pothos/core": "^4.3.0",
|
||||
"@pothos/plugin-prisma": "^4.4.0",
|
||||
"@prisma/client": "6.0.1",
|
||||
"@supabase/supabase-js": "^2.47.6",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"@types/bun": "^1.1.14",
|
||||
"graphql": "^16.9.0",
|
||||
"graphql-yoga": "^5.10.4",
|
||||
"lucia": "^3.2.2",
|
||||
"oslo": "^1.2.1",
|
||||
"pino": "^9.5.0",
|
||||
"pino-pretty": "^13.0.0",
|
||||
"storybook-dark-mode": "^4.0.2",
|
||||
|
|
|
|||
|
|
@ -29,3 +29,11 @@ model Post {
|
|||
author User @relation(fields: [authorId], references: [id])
|
||||
authorId Int
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id
|
||||
userId String
|
||||
expiresAt DateTime
|
||||
|
||||
|
|
||||
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue
NIT: references and fields is backwards from how post shows it, can we keep them consistent