How the code is produced
The authenticator and the server share a secret. Each side combines that secret with the current time step and runs an HMAC calculation to produce a short code. The user only sees the final digits, not the secret itself.
Why the code expires
The time step keeps the code short-lived, which limits reuse. If the server and the device disagree about the time or the step window, a valid code can still be rejected.
What to check in a setup
Issuer, account label, algorithm, digit count, and period all matter. Most services choose 6 digits and 30 seconds, but the platform controls the final parameters.
Action items
- Use the TOTP generator only with a test secret or a clearly understood setup.
- Verify the period and digits shown by the platform during manual setup.
- Sync device time automatically before troubleshooting codes.
Cautions
- TOTP is not phishing-resistant in the same way passkeys are.
- The secret behind the code is the real credential; keep it private.