Tutorials and Explainers
These tutorials are contributed by the community. Unless otherwise indicated, tutorials are hosted on this site. External and video based tutorials are denoted with the appropriate icons.
New submissions and edits are welcome!
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.
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.
Adding Authentication to an existing Next.js Application in no time!
- This 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.
Adding social authentication support to a Next.js app
- A tutorial by Arunoda Susirpiala. Checkout GetStarted for more examples.
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.
NextJS Authentication Crash Course with NextAuth.js
- This tutorial dives into the ins and outs of NextAuth, including using the Email, Github, Twitter and Auth0 providers in under an 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
Passwordless Authentication with next-auth
- A video tutorial by Xiaoru Li from Prisma.
How to authenticate Next.js Apps with Sign-In With Ethereum (SIWE) & NextAuth.js
- Learn how to use Sign-In With Ethereum to authenticate your users with their existing Ethereum wallets - identifiers they personally control.
- Example application: spruceid/siwe-next-auth-example
Next.js Authentication with Okta and NextAuth.js 4.0
- Learn how to perform authentication with an OIDC Application in Okta and NextAuth.js.
Build a FullStack App with Next.js, NextAuth.js, Supabase & Prisma
In this free course, you'll learn how to build a full-stack app using the following technologies:
- Next.js - The React framework for building the UI of the app and the REST API
- NextAuth.js - For implementing passwordless and OAuth authentication
- Supabase - For persisting the app data into a PostgreSQL database and storing media files
- Prisma - For making it easy to read and write data from our app from and to the database
The app that we'll work on in this course is called SupaVacation. It is an online marketplace for vacation rentals where users can browse through all the properties for rent, bookmark their favorite ones, and even rent their own properties.
Here's a live demo of the app's final version. It is what your app should look likes after completing this course. Feel free to play with it to get an overview of all the features you'll be working on.
Magic Link Authentication in Next.js with NextAuth and Fauna
Learn how to implement passwordless/magic link authentication with database storage in your Next.js projects using NextAuth and Fauna DB.
The final version of the project's code can be found on Github. You can use it as a starting point for any Next.js app that requires passwordless authentication.
You can also preview the example live here.
This tutorial covers:
- Configuring Next.js, NextAuth.js, and Fauna to work together seamlessly
- Using Next.js dynamic API routes to handle authentication requests
- Using Fauna and the Fauna Adapter for
next-authto persist users, email sign in tokens, and sessions
- Creating custom login and confirmation pages with React + Tailwind CSS
- Customizing the sign-in email and sending a welcome email to new users
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 full-stack app in TypeScript with Next.js using Prisma Client as a backend. It also demonstrates how to implement authentication using NextAuth.js. By Nikolas Burk at Prisma.
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.
Sign in with Apple in NextJS
- 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.
Using NextAuth.js with Magic links
- Learn how to use Magic.Link authentication with NextAuth.js to enable passwordless authentication without a database.
Create a NextAuth.js Custom Adapter with HarperDB & Next.js
- Use a custom database in a Custom Adapter for persisted NextAuth.js sessions using HarperDB as an example.
- Video tutorial also available: https://www.youtube.com/watch?v=pu7xBv7sZ8s
Using NextAuth.js with Prisma and PlanetScale serverless databases
- How to set up a PlanetScale database to fetch and store user / account data with the Prisma adapter.