An email code is a six-digit number sent to the person’s address. They type it into your app and are signed in. Unlike a link, a code works where links do not: in-app browsers, mail previews, and mobile apps where opening a link would leave the app.

In Studio

Users & auth → Sign-in → Sign-in & registration → Ways to sign in → Email code. Switch it on and save. (It is also on the Authentication flow screen as Email one-time code.) Customise the message under Email templates: Sign-in code.

Sign in with a code

Two steps: ask for the code, then submit it.

Limits

  • A code lasts 10 minutes and allows 5 wrong attempts. After that, ask for a new one.
  • Requests are rate limited, so add a short wait before “send again”.
  • Using the code proves ownership of the inbox, so the address becomes verified.

A complete flow

autoComplete="one-time-code" lets phones fill the code from the message.

Be kind about errors

  • Say “if that address has an account, we sent a code”, not whether it exists.
  • Keep the email on screen so people don’t retype it.
  • Offer “send a new code” after a pause, and “use a link/password instead”.
  • Tell people to check spam, and make sure your sending address is set up under Mail.

Sign-in links

One click instead of typing.

Email templates

Change the wording.