Builder12 min readBadge: Gatekeeper

Sign-in explained: accounts, sessions and permissions

Authentication vs authorization, the ways people sign in (passwords, magic links, Google, passkeys), how sessions work, and why you should never build it yourself.

Two different questions

Authentication asks 'who are you?' (signing in). Authorization asks 'what are you allowed to do?' (permissions). An app needs both: a signed-in member still shouldn't see the admin page or another member's data. Mixing them up is one of the most common security bugs in AI-built apps.

Ways to sign in

  • Email and password, ideally with multifactor authentication (a code or app prompt as a second step).
  • Magic links: a one-time sign-in link sent to the user's email; no password to forget or leak.
  • Sign in with Google, Apple or GitHub (OAuth): another provider vouches for the user.
  • Passkeys: the device unlocks with a fingerprint, face or PIN, and nothing reusable is typed or sent, so they resist phishing.

Sessions: staying signed in

After signing in, the app gives the browser a session, usually a token stored in a cookie. Each request carries it, so the server knows who's asking. Sessions expire for safety, which is why you sometimes see 'session expired' or 'JWT expired' and need to sign in again. Signing out should end the session on the server too, not just hide the menu.

Don't build it yourself

Use a proven auth service such as Supabase Auth, Clerk or Auth0 instead of storing passwords yourself. Then check permissions on the server and in the database (row level security), never only by hiding buttons in the browser. Give people a safe password reset, rate-limit sign-in attempts, and collect only the account details you need.

Key terms

Authentication
Checking who someone is (signing in).
Authorisation
Checking what a signed-in person is allowed to do.
Session
Proof you've signed in, usually a token in a cookie, sent with each request until it expires.
OAuth (sign in with Google)
Signing in through another provider, like Google or GitHub, which vouches for who you are.
Magic link
A one-time sign-in link sent to your email, so there's no password to remember.
Passkey
A sign-in your device unlocks with a fingerprint, face or PIN; nothing reusable is typed, so it resists phishing.
Two-factor authentication (2FA)
A second check at sign-in, like a code from an app, on top of your password.
Row level security (RLS)
Database rules that decide which rows each user may read or change.
See the full glossary

Try it

Map your app's gates

  1. List every page in your app and write who may see it: anyone, signed-in members, or admins.
  2. For each, note where the check happens. If it's only in the browser, ask your AI helper to add a server or database check.
  3. Sign out, then try to open a members-only page directly by its URL.
  4. Turn on multifactor authentication for your own accounts on the services your app uses.

Ask an AI tutor about this guide

Copy a prompt into ChatGPT, Claude or Gemini to go deeper. Check what it tells you against the guide.

Study with an AI tutor: copy this whole guide with tutoring instructions, then paste it into your AI assistant.
  • Explain it like I'm 12
  • Quiz me (5 questions, one at a time)
  • Show me a real example for my situation
  • What do beginners get wrong?

Knowledge check

Five questions. Get 4 right to earn the Gatekeeper badge. You can retake it as often as you like.

Question 1 of 5

What's the difference between authentication and authorization?

Finished the How software works guides? Take the How software works track test for ten mixed questions.

My notes

Write what clicked, what confused you, and what you want to try. Saved in this browser only.

Learn it live

Digital Builders University runs small live workshops where you build something real with an instructor beside you, starting with Vibe Coding 101.

See workshops

Last reviewed November 25, 2026. AI tools change fast; check each tool’s own site for current features, plans and prices.