A one-time code is a short number you type in to prove it is really you.
It may come by text or appear in an app, and anyone who gets it in time can use it. This guide is for anyone who signs in with a six-digit code and wonders how scammers still get in. You do not need any technical knowledge. If you look after staff accounts or a small business, it also shows what to switch to.
In short
- A one-time code is much better than a password alone, but it is not phishing resistant.
- The weak spot is you, the person: a fake website or a convincing caller can ask you to type or read out the code, then use it straight away.
- Codes sent by text message have extra risks, such as a criminal taking over your phone number.
- Passkeys and security keys are stronger because they only work on the real website.
What you will learn
- Explain why a code that expires quickly can still be stolen.
- Spot the two common tricks: the fake sign-in page and the "please read me the code" call.
- Rank text codes, app codes and passkeys from weaker to stronger.
- Take simple steps this week to protect your most important accounts.
- Throwaway code (one-time password)
- a code that works once, or for a short time.
- Fake front door (phishing page)
- a copy of a real sign-in page that passes what you type to a criminal.
- Site-locked key (passkey)
- a sign-in method that only works on the real website it was made for.
What is a one-time code?
Think of a one-time code like a raffle ticket. It is only good for one draw, so an old ticket is worthless. But if someone grabs your ticket before the draw, they can win with it.
A one-time code works the same way. After your password, the website asks for a short code. It may arrive by text message or appear in an authenticator app on your phone. The code only works once and expires quickly, so a code stolen last week will not work.
The trouble is the word "quickly". A code is safe from being reused later, but not from being used now by someone else. NIST, the US standards body, says plainly that one-time code sign-in is not phishing resistant [1]. The US cyber agency CISA explains why: a person can be tricked into typing a six-digit code into a fake sign-in site [2].
Where the comparison stops working: you can hide a raffle ticket in your pocket. A one-time code has to be typed by you, so whoever is asking for it gets it, real site or not.
Why does it matter?
Many people think "I have two-step sign-in, so I am safe". Codes stop most password guessing, but criminals have learned to collect the code too.
If you use online banking or email
What could happen: a fake bank caller asks you to "confirm" a code. They use it to sign in or approve a payment.
Check this: never read a code out to anyone who contacted you. Your bank does not need it.
Next: OTP security
If you run a small business
What could happen: a staff member types a code into a fake email sign-in page, and a criminal reads company mail.
Check this: find out which sign-in methods your email and finance tools offer, and whether passkeys are one of them.
If you are new to security work
What could happen: administrators sign in with text codes, so one phone number takeover opens important systems.
Check this: list who still uses text codes and move administrators first.
What does it look like?
Here is a made-up text message of the kind a criminal sends just after triggering a real code. Notice how it mixes a real code with a fake request.
Example only. All values are made up.
From: EXAMPLE-BANK (1) Your code is 000000. It expires in 5 minutes. (2) [Call from "EXAMPLE-BANK Fraud Team", 0000 000 000] (3) "We have blocked a payment. Please read me the code we just sent so we can cancel it." (4)
- The sender name can look right. In a real file, this line would contain your bank's genuine sender name, which is easy to copy.
- In a real file, this line would contain a genuine code: the criminal started a real sign-in, so the real site sent it to you.
- The caller ID can be faked to show your bank's name or number.
- The request is the attack. Reading out the code hands over the sign-in or the payment approval.
Why this is risky: the code works perfectly. It just goes to the wrong person.
The safer way: treat any code as something only you type, only on a site you opened yourself. Hang up and call the number on your card if in doubt.
How does it work?
The most common trick against codes is the fake sign-in page that passes everything through in real time. Security teams call it a relay or adversary-in-the-middle attack.
- The lure. You get an email or text with a link to what looks like your usual sign-in page.
- You type your password. The fake page quietly sends it to the real site, which then asks for a code.
- You type the code. The fake page passes it on within seconds, well before it expires.
- The criminal is in. The real site thinks the sign-in was you and lets the criminal's session through.

Text message codes carry extra risks. CISA calls text or voice codes the weakest option. They are open to phishing and to SIM swap attacks. CISA says to use them only as a last resort while moving to something stronger [2]. NIST lists phone network codes as "restricted". It asks services to watch for signs such as a recent SIM change or number transfer [1].
App codes avoid the phone number risks, but they can still be typed into a fake page [2].
Passkeys work differently. Your device signs a challenge from the website with a secret key that never leaves it. That signature is tied to the real site's address. A fake site gets nothing it can reuse [3]. CISA calls the standard behind passkeys, FIDO and WebAuthn, the only widely available phishing-resistant option [2].
| Method | Main weakness | Phishing resistant? |
|---|---|---|
| Text or voice code | Phishing, SIM swap, phone network attacks | No |
| Authenticator app code | Can be typed into a fake page | No |
| Push approval with number matching | Can still be phished | No |
| Passkey or security key (FIDO) | Needs set-up and a backup plan | Yes |
Source for the table: CISA's phishing-resistant MFA fact sheet [2].
A worked example
This story is made up to show the idea.
Amara Okafor runs the office for a small charity. One morning she gets an email saying her shared mailbox is almost full, with a link to "sign in and upgrade".
The page looks exactly like her usual email sign-in. She types her password. A code arrives in her authenticator app, so she types that too. The page shows a spinning wheel, then an error.
That afternoon, two donors ask why they got an odd invoice from her address. Amara calls the charity's IT volunteer. He finds a sign-in from another country at the exact time she typed her code, and a new rule hiding replies in her mailbox.
He ends all her sessions, resets her password and removes the rule. Then he sets up a passkey on her laptop and phone, and asks the other staff to do the same.
A month later Amara gets a similar email. This time she clicks out of habit, but her passkey simply does not offer itself on the fake page. That pause is enough for her to notice the strange web address.
The lesson: the code did its job, but Amara was tricked into handing it over. A passkey takes that choice out of her hands.
Myths and mistakes
| What people think | What is true |
|---|---|
| The code expires quickly, so nobody can steal it. | A relay page uses it within seconds. Short life stops reuse later, not theft now. |
| An app code is phishing resistant. | App codes avoid SIM swap, but you can still type one into a fake page[2]. |
| My bank might ask me to read out a code to stop fraud. | A code you are asked to read out to a caller is the classic scam. Hang up and call the number on your card. |
| Codes are pointless, so I may as well turn them off. | Codes still stop most password guessing. Keep them until you can move to passkeys. |
| Passkeys need special hardware. | Passkeys can live on the phone or laptop you already own and use the same PIN or fingerprint you unlock it with[3]. |
What can I do this week?
- Turn on a passkey for your main email account if it offers one.
- For accounts that only offer codes, choose an authenticator app over text messages where you can.
- Ask your mobile provider about a PIN or lock on number transfers.
- Tell family or staff one rule: never read a code out to someone who called you.
- Read OTP Bots and Real-Time OTP Relay to see how these scams are automated.
Checklist
- I can explain why a fresh code can still be stolen.
- I only type a code on a site I opened myself.
- I never read a code out to a caller.
- I know text codes are the weakest kind of code.
- I use an app instead of text messages where I can.
- I have a passkey on at least one important account.
- I know how to end all sessions on my email account if I slip up.
Common questions
Why are one-time codes vulnerable if they expire so fast?
Because the attack happens in real time. A fake page or a scam caller gets the code while it is still valid and uses it at once. Expiry only stops someone using an old code later.
Is an authenticator app safer than a text message?
Yes, for one reason: it does not depend on your phone number, so a SIM swap cannot redirect it. It is still not phishing resistant, because you can type its code into a fake page.
What is stronger than a one-time code?
Passkeys and hardware security keys based on the FIDO standard. They only work with the real website, so a fake site gets nothing useful. CISA calls this the gold standard for sign-in protection[2].
What should I do if I typed a code into a fake page?
Go to the real site yourself, change your password and sign out of all sessions. Check for new forwarding rules or recovery details you did not add. At work, tell your IT or security team straight away.
Where next?
Ready for the detail? Read the practitioner guide: Phishing-Resistant MFA Guide. It covers how organisations plan, roll out and enforce passkeys and security keys.
Also useful:
- OTP Bots and Real-Time OTP Relay
- Authenticator Apps and OTP Guide
- SIM Swap Fraud for Beginners
- MFA Fatigue Attacks for Beginners
Related NHI Mgmt Group resources: OTP security, Passwordless MFA vs OTP-Based MFA and Session Hijacking for Beginners.
Key terms
- One-Time Password
- A code that works once, or for a short time, used as an extra sign-in step.
- Phishing-Resistant MFA
- Sign-in protection that a fake website cannot trick you into handing over, because it only works with the real site.
- Adversary-in-the-middle Attack
- An attack where a criminal sits between you and the real website, passing your details on and keeping a copy.
- SIM swap
- When a criminal gets your phone number moved to their own SIM card, so your texts and calls go to them.
- TOTP
- Time-based one-time password: the kind of code an authenticator app shows, which changes after a short time.
- WebAuthn
- The web standard behind passkeys, which ties each sign-in to the real website's address.
Sources and further reading
- NIST, "SP 800-63B-4: Authentication and Authenticator Management", Digital Identity Guidelines. https://pages.nist.gov/800-63-4/sp800-63b.html (accessed 30 Nov 2026).
- CISA, "Implementing Phishing-Resistant MFA" fact sheet. https://www.cisa.gov/sites/default/files/publications/fact-sheet-implementing-phishing-resistant-mfa-508c.pdf (accessed 30 Nov 2026).
- FIDO Alliance, "Passkeys". https://fidoalliance.org/passkeys/ (accessed 30 Nov 2026).