Magic Links and Email Login Codes: How Safe Are They?

Published

Magic links and email login codes are about as safe as the inbox they're sent to. They remove the password you might reuse or have stolen, and each link or code works once for a short time. But whoever controls your email can log in as you, and a code can be phished like a password. NIST, the US standards agency, says email shouldn't be used as a way to authenticate a login. Use email sign-in only with a well-protected mailbox, never share a code, and pick a passkey where a site offers one.

How email sign-in works

Instead of a password, the site sends something to your inbox:

  • A magic link. You click it, and the site logs you in.
  • A login code. You type a short code from the email into the site. Slack, for example, lets you confirm your identity with a passkey, single sign-on, or a confirmation code it emails you.

Both work the same way underneath: the email proves you can read that inbox, and the site treats that as proof that you are you.

What's good about it

  • No password to reuse. A leaked password from another site can't open an account that doesn't have one.
  • Short-lived secrets. Good implementations make each code or link work once and expire quickly. For the out-of-band codes it covers, NIST's guideline says the login is invalid unless completed within 10 minutes, and each secret is accepted only once.
  • Nothing to remember. Fewer forgotten passwords means fewer people reaching for weak ones.

Where it's weak

Your inbox becomes the only key

NIST's digital identity guidelines say plainly that email shall not be used for out-of-band authentication. The reasons it gives: a mailbox can often be opened with just a password, mail can be intercepted on its way or at the servers it passes through, and it can be rerouted by attacks such as DNS spoofing. NIST makes an exception for confirmation codes that only validate an email address, because that isn't logging in.

In practice, if someone gets into your email, every account that signs in by email is theirs too. With a password-free account, the email is the account.

Codes can be phished

NIST notes that one-time codes and out-of-band methods are not phishing-resistant. A fake login page asks for your email, the attacker enters it on the real site in the background, the real site emails you a genuine code, and the fake page asks you to type it in. The code is real, so the login works, for the attacker.

People will simply ask for the code

The FTC warns about scammers who send you a verification code and then ask you for it, often with a story about having sent it "by mistake". Its advice is short: don't share a verification code with someone you didn't contact first. The FTC also says anyone who asks for your account verification code is a scammer.

Reset emails stay live for a while

Password reset messages are login links in all but name. NIST's guidelines allow a recovery code sent by email to stay valid for up to 24 hours, compared with 10 minutes for one sent by text or voice. An old reset email sitting in a compromised inbox can still be useful to an intruder.

How to use email login safely

  1. Protect the mailbox first. Turn on two-step verification for your email with an authenticator app or a passkey, and use a unique password. Our guide on protecting your accounts from takeover walks through it.
  2. Enter a code only where you asked for it. Check the address bar before you type a code. If you didn't just start a login on that exact site, don't type it anywhere.
  3. Treat an unexpected code as a warning. It means someone typed your email into a login form. Don't click or share it, and check that your mailbox password is still safe.
  4. Never read a code out loud. No real support agent needs it. Our guide to spotting a phishing email covers the messages that try to get it from you.
  5. Request a fresh code rather than digging up an old email, and delete login and reset emails once you've used them.
  6. Prefer a passkey where it's offered. Passkeys are built to work only on the real site, which defeats the fake-page trick above. NIST requires services at its AAL2 level to offer at least one phishing-resistant option. They aren't flawless either; see how synced passkeys can be stolen.

Email login and temporary addresses

A temporary inbox receives login codes and magic links like any other, which is handy for a one-time look at a site. Open a disposable email, sign in with the code, read what you came for, and let the address expire.

Just remember what that means for password-free accounts. With no password, the only way back in is the inbox, so when a temporary address expires, the account is gone for good. For anything you'll want next week, sign up with an address you keep or a forwarding alias. Our guide to verification codes in a temp inbox explains which codes a temporary address handles well.

FAQ

Are magic links safer than passwords?

They're safer than a reused or weak password, and weaker than a passkey. The deciding factor is how well your email account is protected.

Can someone log in with a code I received but didn't use?

Only if they get the code from you or from your inbox. That's why you should never share it, and why an unexpected code is a sign to check your email security.

Why do some magic links stop working?

They usually work once and expire after a short time. Some sites also expect you to open the link on the same device or browser where you started. Request a new one from the original page.

Is email login safe for banking?

Email shouldn't be the only thing protecting money. NIST's guidelines rule email out as a way to authenticate, so use the bank's app, a passkey or an authenticator where offered.

Read next

All articles of the blog

We use cookies to keep your inbox open in this browser, to show ads and to count visits. Cookie policy