diff --git a/packages/better-auth/src/plugins/two-factor/index.ts b/packages/better-auth/src/plugins/two-factor/index.ts index 14ac89d1fc..bc6ad77b50 100644 --- a/packages/better-auth/src/plugins/two-factor/index.ts +++ b/packages/better-auth/src/plugins/two-factor/index.ts @@ -22,7 +22,7 @@ export const twoFactor = (options?: TwoFactorOptions) => { }; const totp = totp2fa( { - issuer: options?.issuer || "better-auth", + issuer: options?.issuer, ...options?.totpOptions, }, opts.twoFactorTable, diff --git a/packages/better-auth/src/plugins/two-factor/totp/index.ts b/packages/better-auth/src/plugins/two-factor/totp/index.ts index d43814d036..87b04ce21f 100644 --- a/packages/better-auth/src/plugins/two-factor/totp/index.ts +++ b/packages/better-auth/src/plugins/two-factor/totp/index.ts @@ -18,7 +18,7 @@ export type TOTPOptions = { /** * Issuer */ - issuer: string; + issuer?: string; /** * How many digits the otp to be * @@ -115,7 +115,7 @@ export const totp2fa = (options: TOTPOptions, twoFactorTable: string) => { await ctx.context.password.checkPassword(user.id, ctx); return { totpURI: createTOTPKeyURI( - options?.issuer || "BetterAuth", + options.issuer || ctx.context.appName, user.email, Buffer.from(twoFactor.secret), opts,