Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

freeCodeCamp

Next.js Authentication - AuthJS / NextAuth for Role-Based Security

via freeCodeCamp

Overview

Dive into a comprehensive tutorial on implementing authentication in Next.js 13.5 using NextAuth (soon to be called AuthJS). Master role-based authentication for both server-rendered and client-rendered pages, integrate OAuth providers like Google and GitHub, and create a custom authentication provider with MongoDB. Explore project setup, API creation, login/logout functionality, page protection techniques, and custom user database implementation. Follow along with step-by-step instructions, from environment setup to creating user models and forms, while learning best practices for secure authentication in modern web applications.

Syllabus

⌨️ Introduction
⌨️ Environment Setup / Extension Review
⌨️ Project Creation
⌨️ Install NextAuth Auth.js / Create Project Structure
⌨️ Create NextAuth Auth.js API - Options / Routes
⌨️ Setup built-in OAuth Provider - Google / GitHub
⌨️ Login / Logout Funtionality
⌨️ Protecting Pages - Server Side Page
⌨️ Protecting Pages - Client Side Page
⌨️ Protecting Pages - Middleware
⌨️ Creating Custom Provider Creating a Database of Users
⌨️ MongoDB Atlas Signup / Setup
⌨️ Create User Models Mongoose Schema
⌨️ User Form to Create Users
⌨️ Create Users API
⌨️ Setup Custom Provider

Taught by

freeCodeCamp.org

Reviews

Start your review of Next.js Authentication - AuthJS / NextAuth for Role-Based Security

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.