#Authentication

2 items tagged “Authentication

SnippetsNext.js3 min read

Auth Context for Next.js (Cookie-Based Sessions)

A React context wrapping an API — login, logout, signup, and password reset — that keeps the client in sync with an httpOnly session cookie by revalidating on mount.

#React
TILBackend2 min read

Building Authentication Into a Full-Stack App Without Reinventing Sessions Badly

TIL that storing a JWT in localStorage for an app that also needed server-rendered authenticated pages was the wrong call, and cookie-based sessions were less work, not more.

#Authentication