feat: custom session response (#579)

This commit is contained in:
Bereket Engida
2024-11-19 21:16:23 +03:00
committed by GitHub
parent a3f0793d68
commit f5f60a23e8
28 changed files with 425 additions and 95 deletions

View File

@@ -8,6 +8,7 @@ import {
twoFactor,
oneTap,
oAuthProxy,
createAuthEndpoint,
} from "better-auth/plugins";
import { reactInvitationEmail } from "./email/invitation";
import { LibsqlDialect } from "@libsql/kysely-libsql";
@@ -16,7 +17,7 @@ import { resend } from "./email/resend";
import { MysqlDialect } from "kysely";
import { createPool } from "mysql2/promise";
import { nextCookies } from "better-auth/next-js";
import * as ac from "./access-control";
import { customSession } from "./auth/plugins/custom-session";
const from = process.env.BETTER_AUTH_EMAIL || "delivered@resend.dev";
const to = process.env.TEST_EMAIL || "";
@@ -112,12 +113,6 @@ export const auth = betterAuth({
},
plugins: [
organization({
ac: ac.ac,
roles: {
admin: ac.admin,
owner: ac.owner,
member: ac.member,
},
async sendInvitationEmail(data) {
const res = await resend.emails.send({
from,
@@ -159,5 +154,6 @@ export const auth = betterAuth({
oneTap(),
oAuthProxy(),
nextCookies(),
customSession(),
],
});