A collection of patterns for managing auth in Next.js apps
This repo aims to showcase how to implement auth within a Next.js app (auth-demo), using social login and cookies.
bun i
to install dependenciesbun run dev --filter=auth-demo...
to start the demo appThis repo/demo uses Arctic v2 to handle the heavy lifting for the social login flows.
This demo uses Arctic v2 (still a pre-release version, so some parts may change in the future), to implement the common components for OAuth within a web application:
This demo is using Next.js (app router), which uses React Server Components, Next.js Middleware, and React Context for client components consuming the session.
Additionally - this demo currently only supports GitHub as the social login flow (PRs are welcome for contributing other sign-in flows)!
Instructions for creating a new GitHub OAuth app are available here
You'll need to run through that flow twice, once for your production domain and another time for a local domain.