Tutorials and Explainers
NextAuth.js tutorialsβ
These tutorials are contributed by the community and hosted on this site.
New submissions and edits are welcome!
NextJS Authentication Crash Course with NextAuth.jsβ
This tutorial dives in to the ins and outs of NextAuth.js including email, GitHub, Twitter and integrating with Auth0 in under hour.
Create your own NextAuth.js Login Pagesβ
This tutorial shows you how to jump in and create your own custom login pages versus using the ones provided by NextAuth.js
Refresh Token Rotationβ
How to implement refresh token rotation.
Securing pages and API routesβ
How to restrict access to pages and API routes.
Custom models with TypeORMβ
How to use models with custom properties using the TypeORM adapter.
Creating a database adapterβ
How to create a custom adapter, to use any database to fetch and store user / account data.
LDAP Authenticationβ
How to use the Credentials Provider to authenticate against an LDAP database.
This approach can be used to authenticate existing user accounts against any backend.
Testing with Cypressβ
How to write tests using Cypress.
Usage with class componentsβ
How to use useSession()
hook with class components.
Other tutorials and explainersβ
These are tutorials and explainers that have been submitted or that we have found on the web and are hosted elsewhere They include articles, videos and example projects. Submissions for inclusion are welcome!
Adding social authentication support to a Next.js appβ
A tutorial by Arunoda Susirpiala. Checkout GetStarted for more examples.
Add auth support to a Next.js app with a custom backendβ
A tutorial by Arunoda Susirpiala.
How to Configure Azure AD B2C Authentication with Next.jsβ
Configuring authentication with Azure B2C in Next.js is not a particularly straight forward process. We'll look at how to facilitate this using the NextAuth.js library. By Ben Fox.
Authentication patterns for Next.jsβ
Next.js supports multiple patterns for authentication, each designed for different use cases. This guide will allow you to choose your adventure based on your constraints. By Lee Robinson.
Passwordless Authentication with next-authβ
A video tutorial by Xiaoru Li from Prisma.
Passwordless Authentication with Next.js, Prisma, and next-authβ
In this post, you'll learn how to add passwordless authentication to your Next.js app using Prisma and next-auth. By the end of this tutorial, your users will be able to log in to your app with either their GitHub account or a Slack-styled magic link sent right to their Email inbox. By Xiaoru Li.
Fullstack Authentication Example with Next.js and NextAuth.jsβ
This example shows how to implement a fullstack app in TypeScript with Next.js using React (frontend), Next.js API routes and Prisma Client (backend). It also demonstrates how to implement authentication using NextAuth.js. By Nikolas Burk at Prisma.
Adding Authentication to an existing Next.js Application in no time!β
This dev.to
tutorial walks one through adding NextAuth.js to an existing project. Including setting up the OAuth client id and secret, adding the API routes for authentication, protecting pages and API routes behind that authentication, etc.
Introduction to NextAuth.jsβ
This is an introductory video to NextAuth.js for beginners. In this video, it is explained how to set up authentication in a few easy steps and add different configurations to make it more robust and secure.
Adding Sign in With Apple Next JSβ
This tutorial walks step by step on how to get Sign In with Apple working (both locally and on a deployed website) using NextAuth.js.
How to Authenticate Next.js Apps with Twitter & NextAuth.jsβ
Learn how to add Twitter authentication and login to a Next.js app both clientside and serverside with NextAuth.js.