frontend added and socket io
This commit is contained in:
@@ -2,8 +2,8 @@ import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import {
|
||||
admin,
|
||||
apiKey,
|
||||
createAuthMiddleware,
|
||||
// apiKey,
|
||||
// createAuthMiddleware,
|
||||
//customSession,
|
||||
jwt,
|
||||
lastLoginMethod,
|
||||
@@ -31,6 +31,7 @@ export const auth = betterAuth({
|
||||
provider: "pg",
|
||||
schema,
|
||||
}),
|
||||
trustedOrigins: allowedOrigins,
|
||||
// user: {
|
||||
// additionalFields: {
|
||||
// role: {
|
||||
@@ -42,7 +43,7 @@ export const auth = betterAuth({
|
||||
// },
|
||||
plugins: [
|
||||
jwt({ jwt: { expirationTime: "1h" } }),
|
||||
apiKey(),
|
||||
//apiKey(),
|
||||
admin(),
|
||||
lastLoginMethod(),
|
||||
username({
|
||||
@@ -70,7 +71,6 @@ export const auth = betterAuth({
|
||||
// };
|
||||
// }),
|
||||
],
|
||||
trustedOrigins: allowedOrigins,
|
||||
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
@@ -118,16 +118,16 @@ export const auth = betterAuth({
|
||||
secure: false,
|
||||
httpOnly: true,
|
||||
},
|
||||
hooks: {
|
||||
after: createAuthMiddleware(async (ctx) => {
|
||||
if (ctx.path.startsWith("/login")) {
|
||||
const newSession = ctx.context.newSession;
|
||||
if (newSession) {
|
||||
// something here later
|
||||
}
|
||||
}
|
||||
}),
|
||||
},
|
||||
// hooks: {
|
||||
// after: createAuthMiddleware(async (ctx) => {
|
||||
// if (ctx.path.startsWith("/login")) {
|
||||
// const newSession = ctx.context.newSession;
|
||||
// if (newSession) {
|
||||
// // something here later
|
||||
// }
|
||||
// }
|
||||
// }),
|
||||
// },
|
||||
events: {
|
||||
// async onSignInSuccess({ user }: { user: User }) {
|
||||
// await db
|
||||
|
||||
Reference in New Issue
Block a user