OTP: sendVerificationOnSignUp option not working. #435

Closed
opened 2026-03-13 07:45:45 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @leonlonsdale on GitHub (Dec 19, 2024).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. install the OTP plugin and email password registration.
  2. setup the OTP plugin and set sendVerificationOnSignUp to true
  3. Sign up a new account

Current vs. Expected behavior

Expected behaviour:

an email should be sent containing an OTP on sign up.

Current behaviour:

nothing happens

What version of Better Auth are you using?

1.0.22

Provide environment information

Mac OS
iOS
Ubuntu
Windows 11

Which area(s) are affected? (Select all that apply)

Backend, Client

Auth config (if applicable)

export const auth = betterAuth({
  appName: '...',
  database: drizzleAdapter(db, {
    provider: 'pg',
    schema: {...schema },
  }),
  emailAndPassword: {
    enabled: true,
    autoSignIn: true,
    requireEmailVerification: true,
  },
  emailVerification: {
    autoSignInAfterVerification: true,
  },
  socialProviders: {
    //...
  },
  plugins: [
    emailOTP({
      sendVerificationOnSignUp: true,
      async sendVerificationOTP({ email, otp, type }) {
        if (type === 'email-verification') {
          const { data, error } = await resend.emails.send({
            from: 'Test <onboarding@resend.dev>',
            to: email,
            subject: 'Pocket Book verification',
            html: `Your one time password is valid for 5  minutes: ${otp}`,
          });
        }
      },
    }),
    nextCookies(),
  ],
});

Additional context

No response

Originally created by @leonlonsdale on GitHub (Dec 19, 2024). ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce 1. install the OTP plugin and email password registration. 2. setup the OTP plugin and set `sendVerificationOnSignUp` to true 3. Sign up a new account ### Current vs. Expected behavior Expected behaviour: an email should be sent containing an OTP on sign up. Current behaviour: nothing happens ### What version of Better Auth are you using? 1.0.22 ### Provide environment information ```bash Mac OS iOS Ubuntu Windows 11 ``` ### Which area(s) are affected? (Select all that apply) Backend, Client ### Auth config (if applicable) ```typescript export const auth = betterAuth({ appName: '...', database: drizzleAdapter(db, { provider: 'pg', schema: {...schema }, }), emailAndPassword: { enabled: true, autoSignIn: true, requireEmailVerification: true, }, emailVerification: { autoSignInAfterVerification: true, }, socialProviders: { //... }, plugins: [ emailOTP({ sendVerificationOnSignUp: true, async sendVerificationOTP({ email, otp, type }) { if (type === 'email-verification') { const { data, error } = await resend.emails.send({ from: 'Test <onboarding@resend.dev>', to: email, subject: 'Pocket Book verification', html: `Your one time password is valid for 5 minutes: ${otp}`, }); } }, }), nextCookies(), ], }); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 07:45:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#435