mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-02-22 23:21:59 +00:00
22 lines
652 B
TypeScript
22 lines
652 B
TypeScript
import { sendOtp } from "@/actions/auth-actions";
|
|
import { PrismaClient } from "@prisma/client";
|
|
import { betterAuth } from "better-auth";
|
|
import { prismaAdapter } from "better-auth/adapters/prisma";
|
|
import { phoneNumber } from "better-auth/plugins";
|
|
|
|
const prisma = new PrismaClient();
|
|
export const auth = betterAuth({
|
|
database: prismaAdapter(prisma, {
|
|
provider: "sqlite", // or "mysql", "postgresql", ...etc
|
|
}),
|
|
plugins: [
|
|
phoneNumber({
|
|
sendOTP: async ({ phoneNumber, code }) => {
|
|
// Implement sending OTP code via SMS
|
|
console.log("Send OTP in auth.ts", phoneNumber, code);
|
|
await sendOtp(phoneNumber, code);
|
|
},
|
|
}),
|
|
],
|
|
});
|