For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
This section contains methods for Multi-Factor Authentication (MFA). They live in the supabase.auth.mfa namespace.
TOTP (time-based one-time password) and phone are the stable second factors. WebAuthn (passkey) as a second factor is experimental. Opt in with @_spi(Experimental) import Supabase. The first-factor passkey API lives in supabase.auth.passkeys. See the Auth Passkey section.
A user can enroll more than one factor, with an upper limit of 10. A second TOTP factor is a good backup. The server can also issue single-use recovery codes. See mfa.recoveryCodes.generate().
Factor and challenge IDs are UUID values. "\(factor.id)" prints in uppercase, so compare UUID values, not strings. FactorType and AuthenticatorAssuranceLevel are structs. Use .rawValue to get the string.