fix: better logs on validation fail for oauth (#100)

* fix: better errors on phone number plugin

* fix: add validation log on oauth
This commit is contained in:
Bereket Engida
2024-10-05 20:34:07 +03:00
committed by GitHub
parent 5c9519c4f0
commit 3b3598aca9
7 changed files with 194 additions and 58 deletions

View File

@@ -1,5 +1,10 @@
import { betterAuth } from "better-auth";
import { organization, passkey, twoFactor } from "better-auth/plugins";
import {
organization,
passkey,
phoneNumber,
twoFactor,
} from "better-auth/plugins";
import { reactInvitationEmail } from "./email/invitation";
import { LibsqlDialect } from "@libsql/kysely-libsql";
import { reactResetPasswordEmail } from "./email/rest-password";
@@ -24,6 +29,7 @@ export const auth = betterAuth({
},
sendEmailVerificationOnSignUp: true,
async sendVerificationEmail(email, url) {
console.log("Sending verification email to", email);
const res = await resend.emails.send({
from,
to: to || email,
@@ -34,6 +40,14 @@ export const auth = betterAuth({
},
},
plugins: [
phoneNumber({
otp: {
sendOTP(phoneNumber, code) {
console.log(`Sending OTP to ${phoneNumber}: ${code}`);
},
sendOTPonSignUp: true,
},
}),
organization({
async sendInvitationEmail(data) {
const res = await resend.emails.send({