This example shows how to use NextAuth.js with Next.js. The example features adding sign in, and an authenticated API route to your Next.js application.
Deploy the example using Vercel:
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app -e https://github.com/tsuki-lab/nextjs-with-nextauth
yarn create next-app -e https://github.com/tsuki-lab/nextjs-with-nextauth
pnpm create next-app -e https://github.com/tsuki-lab/nextjs-with-nextauth
Deploy it to the cloud with Vercel (Documentation).
Read the https://next-auth.js.org/providers/google ahead.
GOOGLE_ID=
GOOGLE_SECRET=
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET= # generate with `openssl rand -base64 32`