Short answer
Read multiFactor(user).enrolledFactors before showing the enrollment screen. If that phone number is already listed, show it as enrolled and skip enrollment. To replace a number, re-authenticate the user, unenroll the old factor, then enroll the new one.
Rather not fix it yourself? App Fix Ticket starts with a fixed-price diagnosis, then a fixed price for the fix before any fix work.
Why the factor is already enrolled, and the fix
01
The app enrolls without checking first
“The second factor is already enrolled on this account.” Firebase, JS SDK auth errors (second-factor-already-in-use)
An onboarding step that always runs enrollment fails for users who completed it earlier. Check enrolledFactors for the same phone number and only enroll when it is missing.
import { multiFactor, PhoneMultiFactorInfo } from 'firebase/auth'; const factors = multiFactor(auth.currentUser!).enrolledFactors; const alreadyEnrolled = factors.some( (f) => f.factorId === 'phone' && (f as PhoneMultiFactorInfo).phoneNumber === newPhoneNumber, );02
The user wants to change the phone number
“To specify the factor to remove, pass a MultiFactorInfo object (retrieved from MultiFactorUser.enrolledFactors) or the factor's UID string.” Firebase, MultiFactorUser.unenroll()
To replace a phone number, unenroll the old factor by its MultiFactorInfo or UID, then enroll the new number. Both steps need a recent sign-in, so re-authenticate the user first.
03
The settings screen does not show existing factors
“Returns a list of the user's enrolled second factors.” Firebase, MultiFactorUser.enrolledFactors
Users enroll again when they can’t see that they already did. List the enrolled factors with their display names on the security screen.
04
Too many factors
“The maximum allowed number of second factors on a user has been exceeded.” Firebase, JS SDK auth errors (maximum-second-factor-count-exceeded)
Also check: a different error, auth/maximum-second-factor-count-exceeded, means the user has reached the maximum number of second factors. Unenroll one before adding another.
Checked against the vendor’s docs on : Firebase JS SDK reference: MultiFactorUser; Firebase JS SDK source: auth errors; Firebase docs: Add multi-factor authentication to your web app.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
Related: Firebase auth/multi-factor-auth-required · Firebase auth/requires-recent-login · Firebase auth/web-storage-unsupported · Firebase credential-already-in-use