From 1e775cb4d9e91a6c59995f26dd8eaed6fe97c78b Mon Sep 17 00:00:00 2001 From: John Tanzer <82201261+moshetanzer@users.noreply.github.com> Date: Wed, 26 Mar 2025 21:16:32 +0200 Subject: [PATCH] docs: add disable 2fa (#2013) --- docs/content/docs/plugins/2fa.mdx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/content/docs/plugins/2fa.mdx b/docs/content/docs/plugins/2fa.mdx index d7d0adf8..076d8be0 100644 --- a/docs/content/docs/plugins/2fa.mdx +++ b/docs/content/docs/plugins/2fa.mdx @@ -160,6 +160,16 @@ const response = await auth.api.signInEmail({ }) ``` +### Disabling 2FA + +To disable two-factor authentication, call `twoFactor.disable` with the user's password: + +```ts title="two-factor.ts" +const { data } = await authClient.twoFactor.disable({ + password: "password" // user password required +}) +``` + ### TOTP TOTP (Time-Based One-Time Password) is an algorithm that generates a unique password for each login attempt using time as a counter. Every fixed interval (Better Auth defaults to 30 seconds), a new password is generated. This addresses several issues with traditional passwords: they can be forgotten, stolen, or guessed. OTPs solve some of these problems, but their delivery via SMS or email can be unreliable (or even risky, considering it opens new attack vectors).