Sub topic 9
Verification codes for two-factor sign-in
This chapter assumes you have a Mac running macOS Sequoia 15 or later, an Apple Account signed in, and at least one login saved in the Passwords app. It also assumes you know how to open an entry and how AutoFill works in Safari.
What a verification code is
Two-factor sign-in asks for something beyond your password. One common form is a six-digit verification code that changes every 30 seconds. The code comes from a shared secret, a value your Mac and the website both hold. Both sides use the secret and the current time to calculate the same number, so no message has to be sent.
The Passwords app can store that secret inside a login entry. It then shows the current code, and Safari can fill it for you. You no longer need a separate authenticator app.
Set up a code for a login
Most sites show a QR code or a setup key when you turn on two-factor sign-in. The steps below assume the site is showing one of these.
- Open the Passwords app and select the login for the site.
- Click Edit, then click Add next to Verification Code.
- Choose to enter the setup key, or to scan the QR code on your screen. Enter the key the site displays, or follow the prompt to scan the code.
- Click Save. A six-digit code now appears in the entry and counts down.
- Type that code into the site to confirm the setup.
Treat the setup key like a password. Anyone who has it can generate your codes.
Fill a code when you sign in
After you enter your password, the site asks for a code. Safari can offer the current code in the field, and you choose it to fill it in. If your sign-in form shows no suggestion, open the Passwords app, select the entry, and copy the code from there. Codes expire quickly, so copy and use one right away.
Common errors
| Symptom | Likely cause | What to do |
|---|---|---|
| The site rejects a correct-looking code | The code expired as you typed it | Wait for the next code and enter it quickly |
| Codes are always rejected | The Mac's clock is wrong | Turn on Set time and date automatically in System Settings |
| No code option on the entry | No setup key was saved | Edit the entry and add the verification code again |
| Locked out of a site | Setup key was never saved elsewhere | Use the backup codes the site gave you |
Keep a backup
Many sites show backup codes when you turn on two-factor sign-in. Save them somewhere safe. If you lose access to your Apple Account, these codes are often the only way back in.
If you export passwords as a CSV file, verification setup links go into the OTPAuth column, as in the sample below. Delete the file once the import is done.
Title,URL,Username,Password,Notes,OTPAuth
Example Site,https://example.com,[email protected],replace-with-real-password,,Exercise
A site rejects a code that you copied from the Passwords app a minute ago. Give two reasons it might fail, and say what you do first.
Show answer
The code probably expired, because it changes every 30 seconds. The Mac's clock could also be wrong, which makes the calculated code differ from the site's. First, copy the current code and enter it right away. If it still fails, check that Set time and date automatically is on in System Settings.
Exercise
Why should you finish setup by entering a code from the app into the site?
Show answer
The site only turns on two-factor sign-in once it has seen a valid code. That also proves the saved setup key works.