import { betterAuth } from "better-auth";
import { createPool } from "mysql2/promise";
import {
openAPI,
oAuthProxy,
multiSession,
} from "better-auth/plugins";
import { nextCookies } from "better-auth/next-js";
import { passkey } from "better-auth/plugins/passkey";
import transporter from "./email/nodemailer";
import dotenv from "dotenv";
dotenv.config();
export const auth = betterAuth({
appName: "EPF Projets - API Gateway",
database: createPool({
...
}),
user: {
additionalFields: {
firstName: {
type: "string"
},
sex: {
type: "string",
required: false,
defaultValue: "",
},
phone: {
type: "string",
required: false,
defaultValue: ""
},
address: {
type: "string",
required: false,
defaultValue: ""
},
city: {
type: "string",
required: false,
defaultValue: ""
},
zipCode: {
type: "string",
required: false,
defaultValue: ""
},
country: {
type: "string",
required: false,
defaultValue: ""
},
bio: {
type: "string",
required: false,
defaultValue: ""
}
}
},
...
}
import { betterAuth } from "better-auth";
import { createPool } from "mysql2/promise";
import {
openAPI,
oAuthProxy,
multiSession,
} from "better-auth/plugins";
import { nextCookies } from "better-auth/next-js";
import { passkey } from "better-auth/plugins/passkey";
import transporter from "./email/nodemailer";
import dotenv from "dotenv";
dotenv.config();
export const auth = betterAuth({
appName: "EPF Projets - API Gateway",
database: createPool({
...
}),
user: {
additionalFields: {
firstName: {
type: "string"
},
sex: {
type: "string",
required: false,
defaultValue: "",
},
phone: {
type: "string",
required: false,
defaultValue: ""
},
address: {
type: "string",
required: false,
defaultValue: ""
},
city: {
type: "string",
required: false,
defaultValue: ""
},
zipCode: {
type: "string",
required: false,
defaultValue: ""
},
country: {
type: "string",
required: false,
defaultValue: ""
},
bio: {
type: "string",
required: false,
defaultValue: ""
}
}
},
...
}