You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I confirm this is a bug with Supabase, not with my own application.
I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Enrolling a TOTP factor fails with HTTP 500 (unexpected_failure) for users
who signed up with a phone number and have no email address.
enrollTOTPFactor in internal/api/mfa.go passes user.GetEmail() as the AccountName to totp.Generate. For a phone-only user that string is empty, github.com/pquerna/otp rejects it (AccountName must be set), and the
handler returns QRCodeGenerationErrorMessage as an internal server error.
To Reproduce
Enable phone sign-in (SMS OTP) and TOTP MFA enrollment.
Sign in with a phone number only (the user has no email).
The request fails with HTTP 500 and no factor is created.
Reproduced with the Supabase CLI 2.120.0 local stack (auth v2.197.0). The same
code is still on master (internal/api/mfa.go line 289 at ce9a8ee).
Expected behavior
Phone-only users can enroll TOTP. When the user has no email, the account name
shown in authenticator apps falls back to the phone number (or another stable
identifier).
Screenshots
N/A.
System information
OS: Ubuntu 24.04 (CI) and macOS
Version of supabase-js: 2.117.3
Version of Node.js: 24
Supabase CLI: 2.120.0 (auth v2.197.0)
Additional context
Apps that use the phone number as the only identity and require TOTP as the
second factor cannot offer TOTP at all today. Phone-first sign-in is common in
regions where email is not the primary identifier.
I have a small fix with a regression test and will open a PR referencing this
issue.
Reproduced on current master (0725a1d): a phone-only user gets 500 "Error generating QR Code" on POST /factors with factor_type: totp, and the server logs AccountName must be set. A Sign in with Solana user (no email or phone either) gets the same 500. #2873 fixes both when merged on 0725a1d. I put the details on the PR.
Activity
montjeffrey commentedon Nov 27, 2026
Reproduced on current
master(0725a1d): a phone-only user gets 500 "Error generating QR Code" onPOST /factorswithfactor_type: totp, and the server logsAccountName must be set. A Sign in with Solana user (no email or phone either) gets the same 500. #2873 fixes both when merged on0725a1d. I put the details on the PR.