© 2026 Hedgehog Software, LLC
export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "sqlite" }), emailAndPassword: { enabled: true, requireEmailVerification: true, }, emailVerification: { sendVerificationEmail: async ({ user, url }) => { console.log("DAS sending email verification to user ", user.email, url); sendVerification({ email: user.email, url }); }, },
try { await auth.api.signInEmail({ body: { email, password: _password, callbackURL: "/trips" }, }); } catch (error) { console.log("DAS sign-in error", error); if (hasErrorCode(error)) { if (error.body.code === "EMAIL_NOT_VERIFIED") { return invalid(issue("Please verify your email before signing in.")); } } invalid(issue("An unexpected error occurred during sign in.")); }
DAS sign-in error [InternalAPIError: Email not verified] { status: 'FORBIDDEN', body: { code: 'EMAIL_NOT_VERIFIED', message: 'Email not verified' }, headers: {}, statusCode: 403 }
sendVerificationEmail
If you enable require email verification, users must verify their email before they can log in. And every time a user tries to sign in, sendVerificationEmail is called.