[GH-ISSUE #1010] OTP password reset doesn't create credentials account for existing social accounts #8547

Closed
opened 2026-04-13 03:39:58 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @PawelPotempa on GitHub (Dec 24, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1010

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Use the OTP plugin
  2. Create an account via OAuth, i.e. Google
  3. Sign out
  4. Attempt to reset password for the same email as the used social
  5. Network tab returns 200s, but no account is created via the reset password flow

Current vs. Expected behavior

As a form of account linking, when an email address was used via social sign up, a password reset flow should allow for account creation. Currently it doesn't do it for OTP password reset.

What version of Better Auth are you using?

1.1.3

Provide environment information

macOS Sonoma 14.5

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

Backend

Auth config (if applicable)

export const auth = betterAuth({
  database: drizzleAdapter(db, {
    provider: 'pg',
  }),
  plugins: [
    emailOTP({
      async sendVerificationOTP({ email, otp, type }) {
        if (type === 'email-verification') {
          console.log('Sending verification email to', email, 'OTP:', otp);
          await sendVerificationEmail(email, otp);
        } else if (type === 'forget-password') {
          console.log('Sending forget password email to', email, 'OTP:', otp);
          await sendPasswordResetEmail(email, otp);
        }
      },
      disableSignUp: true,
      sendVerificationOnSignUp: true,
    }),
  ],
  emailAndPassword: {
    enabled: true,
    minPasswordLength: 8,
    requireEmailVerification: true,
    sendEmailVerificationOnSignUp: true,
    sendResetPasswordEmail: true,
    autoSignIn: true,
  },
  emailVerification: {
    autoSignInAfterVerification: true,
  },
  socialProviders: {
    google: {
      clientId: process.env.GOOGLE_CLIENT_ID || '',
      clientSecret: process.env.GOOGLE_CLIENT_SECRET || '',
      scope: ['openid', 'profile', 'email'],
    },
  },
  account: {
    accountLinking: {
      enabled: true,
      requireEmailVerification: true,
      trustedProviders: ['google'],
    },
  },
  rateLimit: {
    window: 60,
    max: 10,
  },
});

Additional context

No response

Originally created by @PawelPotempa on GitHub (Dec 24, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1010 ### Is this suited for github? - [X] Yes, this is suited for github ### To Reproduce 1. Use the OTP plugin 2. Create an account via OAuth, i.e. Google 3. Sign out 4. Attempt to reset password for the same email as the used social 5. Network tab returns 200s, but no account is created via the reset password flow ### Current vs. Expected behavior As a form of account linking, when an email address was used via social sign up, a password reset flow should allow for account creation. Currently it doesn't do it for OTP password reset. ### What version of Better Auth are you using? 1.1.3 ### Provide environment information ```bash macOS Sonoma 14.5 ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript export const auth = betterAuth({ database: drizzleAdapter(db, { provider: 'pg', }), plugins: [ emailOTP({ async sendVerificationOTP({ email, otp, type }) { if (type === 'email-verification') { console.log('Sending verification email to', email, 'OTP:', otp); await sendVerificationEmail(email, otp); } else if (type === 'forget-password') { console.log('Sending forget password email to', email, 'OTP:', otp); await sendPasswordResetEmail(email, otp); } }, disableSignUp: true, sendVerificationOnSignUp: true, }), ], emailAndPassword: { enabled: true, minPasswordLength: 8, requireEmailVerification: true, sendEmailVerificationOnSignUp: true, sendResetPasswordEmail: true, autoSignIn: true, }, emailVerification: { autoSignInAfterVerification: true, }, socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID || '', clientSecret: process.env.GOOGLE_CLIENT_SECRET || '', scope: ['openid', 'profile', 'email'], }, }, account: { accountLinking: { enabled: true, requireEmailVerification: true, trustedProviders: ['google'], }, }, rateLimit: { window: 60, max: 10, }, }); ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 03:39:58 -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#8547