Skip to content

tsuki-lab/nextjs-with-nextauth

Repository files navigation

NextAuth.js and Next.js Example

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 your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

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).

Getting started

Read the https://next-auth.js.org/providers/google ahead.

Environment variables

GOOGLE_ID=
GOOGLE_SECRET=
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET= # generate with `openssl rand -base64 32`