feat: integrate @better-auth/infra for dashboard and sentinel monitoring
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
"prisma:seed:reset:plans": "bun prisma/reset-plans.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@better-auth/infra": "^0.2.4",
|
||||
"@hono/zod-validator": "^0.7.6",
|
||||
"@prisma/adapter-pg": "^7.6.0",
|
||||
"@prisma/client": "^7",
|
||||
|
||||
@@ -2,32 +2,36 @@ import { betterAuth } from 'better-auth';
|
||||
import { prismaAdapter } from 'better-auth/adapters/prisma';
|
||||
import { openAPI } from 'better-auth/plugins';
|
||||
import { db } from './prisma';
|
||||
import { dash } from "@better-auth/infra";
|
||||
|
||||
export const auth = betterAuth({
|
||||
database: prismaAdapter(db, {
|
||||
provider: 'postgresql',
|
||||
}),
|
||||
secret: process.env.BETTER_AUTH_SECRET,
|
||||
baseURL: process.env.BETTER_AUTH_URL,
|
||||
session: {
|
||||
cookieCache: {
|
||||
enabled: false,
|
||||
database: prismaAdapter(db, {
|
||||
provider: 'postgresql',
|
||||
}),
|
||||
secret: process.env.BETTER_AUTH_SECRET,
|
||||
baseURL: process.env.BETTER_AUTH_URL,
|
||||
session: {
|
||||
cookieCache: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
socialProviders: {
|
||||
google: {
|
||||
clientId: process.env.GOOGLE_CLIENT_ID!,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
trustedOrigins: [
|
||||
process.env.APP_BASE_URL ?? 'http://localhost:5173',
|
||||
process.env.BETTER_AUTH_URL ?? 'http://localhost:3000',
|
||||
],
|
||||
plugins: [openAPI()],
|
||||
socialProviders: {
|
||||
google: {
|
||||
clientId: process.env.GOOGLE_CLIENT_ID!,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
||||
},
|
||||
},
|
||||
trustedOrigins: [
|
||||
process.env.APP_BASE_URL ?? 'http://localhost:5173',
|
||||
process.env.BETTER_AUTH_URL ?? 'http://localhost:3000',
|
||||
],
|
||||
plugins: [
|
||||
openAPI(),
|
||||
dash()
|
||||
],
|
||||
});
|
||||
|
||||
export type Session = typeof auth.$Infer.Session.session;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@better-auth/infra": "^0.2.4",
|
||||
"@fontsource-variable/geist": "^5.2.8",
|
||||
"@hookform/resolvers": "^5.2.2",
|
||||
"@radix-ui/react-label": "^2.1.8",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createAuthClient } from 'better-auth/react';
|
||||
import * as api from './api';
|
||||
import { sentinelClient } from "@better-auth/infra/client";
|
||||
|
||||
const apiBaseUrl = api.apiBaseUrl;
|
||||
|
||||
@@ -8,6 +9,7 @@ export const authClient = createAuthClient({
|
||||
fetchOptions: {
|
||||
credentials: 'include',
|
||||
},
|
||||
plugins: [sentinelClient()],
|
||||
});
|
||||
|
||||
export class ApiClientError extends Error {
|
||||
|
||||
Reference in New Issue
Block a user