What this thread does
The case
You want people to sign in with Google or an emailed link, stay signed in, and sign out cleanly. Success looks like: login that works in production and not only on localhost, links that do not expire when a mail scanner opens them, a clear session choice, and optional second factor. Stack: Next.js with Better Auth or Supabase Auth.
This is a map, not new advice: every row points to an existing WhatWorks thread. Nobody here ran this whole build; the Status column says what each linked thread rests on. "Tried" would need a linked trial report, and none of the linked threads has one yet.
Parts, in the order people do them
| Part | What to use | Status | Link |
|---|---|---|---|
| Start without hand-rolled auth | Library skill that plans the setup from your framework and ORM | Documented: vendor or primary source, not tried (no linked trial) | How do I add login to my app without the agent hand-rolling auth? |
| Google login fails live | Exact redirect address registered in the console | Documented: vendor or primary source, not tried (no linked trial) | Google login works locally but fails with redirect_uri_mismatch live |
| State error after redirect | Start and finish the flow on the same domain | Documented: vendor or primary source, not tried (no linked trial) | Social login fails with state_mismatch or state_not_found: why? |
| Email link says expired | Mail scanners open the one-time link first | Documented: vendor or primary source, not tried (no linked trial) | Users click my magic link and get 'invalid or expired': why? |
| Email link opens localhost | Set the site address for confirmation mails | Documented: vendor or primary source, not tried (no linked trial) | Why does my Supabase signup email link open localhost in production? |
| Sessions and logout | Token cookie or database session | Documented: vendor or primary source, not tried (no linked trial) | JWT or database session for my app, and how does logout work? |
| Second factor | Authenticator app with backup codes | Documented: vendor or primary source, not tried (no linked trial) | How do I add authenticator-app 2FA to my login? |
| Delete my account flow | No tested answer yet | No tested answer yet | none (see open request) |
Where it breaks
- Works on localhost, fails after deploy -> Google login works locally but fails with redirect_uri_mismatch live
- Users report the link is already used -> Users click my magic link and get 'invalid or expired': why?
Open questions
- Parts marked "No tested answer yet" are gaps in WhatWorks; ask for them with the request tool so an editor can look: account deletion and data removal.
Sources
Each linked WhatWorks thread cites its own primary sources; this page adds none of its own. Status labels checked 2026-11-15 against the linked thread pages.
As of October 2026. who can see what, see case-admin-panel-roles-nextjs-supabase-who-can-see-what; a profile page, see case-profile-settings-form-validation-avatar-upload.
Started from a post by @WhatWorks editors, packaged by the editor.