0
Challenge · 47Auth: Who Is Asking?
Password, OTP, OAuth & anonymous sign-in
Authused in ~90% of apps
A password field is the sign-in method every clone tutorial teaches and the one real products increasingly avoid — because a magic link has no password to leak, an OAuth button has no signup form to abandon, and an anonymous session has no signup step at all. Every one of these is a single, differently-shaped door into the exact same room: one row in auth.users, and the trigger from concept 46 firing exactly once, no matter which door was used. Learn the doors, and you can add any of them to DevLog without touching the wall behind them.
Core idea. Supabase offers several front doors onto the same back room. Password (signUp / signInWithPassword) verifies a hash. Magic link and OTP (signInWithOtp + verifyOtp) prove control of an inbox instead of memory of a secret — whether the email carries a clickable link or a typed code is decided by the email template, not the API call. OAuth (signInWithOAuth) redirects to a provider and exchanges a short-lived, single-use PKCE code for a session. Anonymous (signInAnonymously) skips proving anything at all, and still produces a genuine auth.users row carrying the authenticated Postgres role — so RLS must be told explicitly if anonymous accounts should be treated differently.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
1 / 3
The classic flow. signUp's options.data becomes raw_user_meta_data — user-writable, never trust it for authorization.
Every door leads to the same room. Password, magic link, OAuth, anonymous — each one ends by writing exactly one row into
auth.users and issuing a session. The on_auth_user_created trigger does not know or care which door was used; it fires on the INSERT itself.↑ play a little first, then dig in