Sub topic 10
Helping users who lose a verification method
This chapter assumes you can find a user's detail page in Setup. It also assumes you know how users register a verification method and that MFA is already enabled in your org. Here you will learn how to get a locked-out user back into their account without weakening the protection MFA gives you.
Why recovery needs a plan
A verification method is tied to something the user owns, such as a phone, an authenticator app, or a security key. Phones get lost, replaced, or wiped. Security keys get left at home. When that happens, the user can enter the correct password and still be unable to sign in.
Your recovery process has two goals that pull against each other:
- Restore access quickly, so the user can work.
- Confirm the person asking is the real account owner, because attackers know that help desks are an easy way around MFA.
If recovery is easy to abuse, MFA is only as strong as your weakest support call. Decide the process before the first request arrives.
What can go wrong
Most cases fall into one of these groups.
| Situation | What the user sees | Typical fix |
|---|---|---|
| Lost or stolen phone | Cannot approve or enter a code | Temporary code, then disconnect the old method and register a new one |
| New phone, same authenticator app | Old codes no longer work | Disconnect the old method, register again on the new phone |
| Security key forgotten | Key prompt cannot be completed | Use another registered method, or a temporary code |
| Authenticator app deleted by accident | Codes are no longer generated | Disconnect and register again |
| Never registered a method | Prompted to register at login | Normal registration, not recovery |
The last row matters for scoping. A user who has never registered a method is not locked out. They are being asked to register for the first time, which the registration chapter covers.
The recovery workflow
The usual path is: verify the person, give them a short-lived way in, remove the lost method, and make them register a replacement.
Step 1: Check for a second method
The best recovery is the one that needs no admin. If a user registered more than one method, such as an authenticator app and a security key, they can choose another method on the verification screen. They can then disconnect the lost one and register a replacement from their own settings.
This is the strongest argument for asking users to register at least two methods. Encourage it during rollout.
Step 2: Verify the person
If the user has no working method, they cannot prove who they are to Salesforce, so you must do it outside Salesforce. Decide on checks that an attacker could not easily pass. Examples:
- Call the user back on a phone number from the HR system, not one the caller supplies.
- Ask their manager to confirm the request in writing.
- Use a video call for high-privilege accounts.
Do not rely on facts that appear in a phishing email or a public profile, such as a birthday or job title. Apply stricter checks to admins and other users with broad permissions, since attackers target those accounts first.
Step 3: Generate a temporary verification code
A temporary verification code is a code an admin creates for one user. The user enters it at the verification prompt instead of a code from a device. It works for a limited time and a limited number of uses, so it does not become a permanent backdoor.
To generate one:
- In Setup, open the user's detail page.
- Find the temporary verification code section and choose to generate a code.
- Set how long the code stays valid and how many times it can be used.
- Give the code to the user through a channel you have already verified.
Keep the lifetime short and the number of uses low. One use and a short expiry are enough for a user who only needs to sign in once and register a new method.
You need the permission that allows managing users' multi-factor authentication methods in the user interface. Assign it to the support staff who handle recovery, and not to every admin. Salesforce lets you grant it through a permission set, so you can give it to a small recovery team.
Step 4: Remove the lost method
Signing in with a temporary code does not remove the old registration. If the lost phone is stolen, its authenticator app might still produce valid codes. Disconnect the old method.
The user can do this from their own settings after signing in. In Advanced User Details, they will find the registered methods listed with a disconnect option. An admin can also disconnect a method from the user's detail page, which is the safer choice when a device is stolen and you cannot wait for the user.
Disconnecting a method does not delete the user or reset their password. If you suspect the password is also exposed, reset it as a separate action.
Step 5: Register a replacement
Walk the user through registering a new method before the temporary code expires or is used up. If they leave without registering, they will hit the same problem at the next login, and you will need another code.
Finding users who may need help
Some users are not locked out yet but have no registered method at all. They will be stopped at their next login. This query, run in the Developer Console query editor or another SOQL tool, lists active users with no recorded verification method:
SELECT Id, Name, Username
FROM User
WHERE IsActive = true
AND Id NOT IN (SELECT UserId FROM TwoFactorInfo)Contact these users before an enforcement date so they register on their own time and not in a rush. The result is also a useful measure of adoption, which the rollout chapter returns to.
Checking activity after a recovery
After you issue a temporary code, look at the user's login history. You want to confirm that the sign-in came from a place and device you expect. This query shows the last week of logins with source IP and status:
SELECT UserId, LoginTime, LoginType, SourceIp, Status, Application
FROM LoginHistory
WHERE LoginTime = LAST_N_DAYS:7
ORDER BY LoginTime DESC
LIMIT 200To focus on one user, add a condition such as AND UserId = '005...' before the ORDER BY line, using the real user ID. Look for failed attempts just before the recovery request, or a successful login from an unfamiliar IP address right after it. Either pattern suggests that the person who asked for the code was not the account owner. In that case, disconnect all methods, reset the password, and follow your incident process.
Common mistakes
- Sending the code over an unverified channel. If you email a code to an address the attacker controls, you have handed over the account.
- Long-lived codes. A code valid for a full day with many uses stays exploitable long after the user has signed in.
- Skipping the disconnect. The old device remains a working factor until it is removed.
- Giving every admin the recovery permission. More people with the permission means more people who can be tricked.
- No record of recoveries. Keep a simple log of who requested a code, who approved it, and how identity was checked. It helps in audits and incident reviews.
- Disabling MFA for the user as a shortcut. Turning off the requirement for one person removes the protection permanently. A temporary code does the same job for a short window.
Putting it together
A workable policy fits on one page:
- Encourage two registered methods per user.
- Define identity checks for each risk level.
- Limit the recovery permission to a small team.
- Use short, single-use temporary codes.
- Disconnect lost methods and require re-registration.
- Review login history and log each case.
Exercise
A user calls to say their phone fell in a lake. They know their password but have no other registered method. List the steps you would take, in order, and name one mistake to avoid.
Show answer
Verify the user's identity through a channel you control, such as a callback to the number in the HR system or confirmation from their manager. Then generate a temporary verification code with a short lifetime and a single use, and deliver it over the verified channel. The user signs in with the code, disconnects the lost phone's method, and registers a replacement, ideally two methods. Afterward, review their login history for anything unexpected and record the case. Mistakes to avoid include issuing the code to an unverified caller, setting a long-lived multi-use code, or turning MFA off for the user instead of using a temporary code.
Exercise
Which query helps you find active users who will be blocked at their next login because they have never registered a verification method, and which object does it check?
Show answer
The User query with Id NOT IN (SELECT UserId FROM TwoFactorInfo) and IsActive = true. It checks the TwoFactorInfo object, which records registered verification methods, and returns active users who have none.