Lesson 5 · about 30 minutes
Sign-in codes and emails
No passwords to remember or leak. People type their email, get a six-digit code, and they're in. Your partner or team joins with an invite. And your app can send confirmations and reminders from your own address.
Passwordless sign-in with emailed codes, invite keys for families and teams, and transactional email from your domain through Cloudflare Email Service. Email to anyone needs Workers Paid ($5/month).
Sign-in with six-digit codes sent by email, stored only as a hash. Codes last 15 minutes, any code that hasn't run out works, and wrong guesses and requests are limited. Sessions use HttpOnly cookies, and invite keys come with roles. Email goes out through Cloudflare Email Service; sending to anyone other than yourself needs Workers Paid.
Your sign-in code is 482 913
It works for 15 minutes.
No passwords, ever.
What you'll make
- Sign-in with an emailed six-digit code
- Invites for a partner, family or team
- Email sent from your own address
You'll need: an app with a database (lesson 4) and, to email other people, your own domain on Cloudflare.
Decide who signs in
Who should see what? A family log might be "us two, plus grandparents who can only look". A club site might be "any member". Say it plainly:
Your agent turns that into rules the server checks on every request, not just hidden buttons.
Sign in with an emailed code
Your sign-in code is 482 913
It works for 15 minutes.
The code types itself in, as it would from the email.
An email with a code, a box to type it in, and you're signed in, staying signed in on that phone.
While testing on your computer, the code shows on screen instead of being emailed, so you can try it before email is set up.
Two emails arrived
"That code isn't right"
Email needs your own domain
To send email, your app needs an address like hello@yourapp.com, which means your own domain on Cloudflare (lesson 10 covers getting one). Cloudflare adds the records that prove the email is really from you.
The cost, from Cloudflare's docs (November 2026): on the free plan you can only send to your own verified addresses. Sending to anyone else (sign-in codes for other people, customers) needs Workers Paid, $5 a month.
Send a test to yourself first
Before any real person gets an email from your app, you get one. Check it arrives, isn't in spam, and reads well.
House rule: your agent asks before the first email to any real address. Every time.
Invite your partner or team
You'll get a short key (like blue-ivy-yew-quill-4485) or a link and QR code to share. Invites run out after a while, and you can take access away from Settings.
I want to start again with a new key
Other emails your app can send
The same setup sends booking confirmations, quotes, receipts, reminders and weekly summaries. Anything that isn't essential gets a one-tap unsubscribe.
Did it work?
Tick these off. They're saved in this browser, so you can come back later.
- I signed in with a code from my email
- Codes run out, and wrong guesses are limited
- My partner or team joined with an invite
- The first emails went to me before anyone else