Mastering Next.js Auth with Credentials | NextAuth, MongoDB, Prisma Tutorial
2.1 هزار بار بازدید -
8 ماه پیش
-
👋 Welcome to the ultimate
👋 Welcome to the ultimate guide on implementing Next.js authentication with credentials! In this step-by-step tutorial, I'll walk you through the entire process of setting up NextAuth for secure authentication, creating user registration with MongoDB and Prisma, building a seamless login experience, and safeguarding your routes with protection. 🔐
🛠️ In this tutorial, we'll cover:
1. Setting up NextAuth for effortless authentication.
2. Creating a user registration system using MongoDB and Prisma for a robust database backend.
3. Implementing a smooth and secure login process for your Next.js application.
4. Crafting protected routes to ensure a secure user experience.
Whether you're a beginner or an experienced developer, this tutorial has something for everyone. 🌟 Follow along and level up your Next.js authentication game!
🚨 Timestamps:
00:00 - Build showcase
02:05 - Setup Environment
06:44 - Next Auth and Prisma
22:30 - Register Api
28:14 - Protected Route
34:45 - Singin and Singup page
41:10 - Input Component
48:40 - Form
54:30 - Register functionality
01:01:30 - Login functionality
01:11:03 - Protected Page
🚨 Important:
I make a mistake in the authorize function when we check the correct password.
Correct Code:
const correctPassword = await bcrypt.compare(credentials.password, user.hashedPassword);
if(!correctPassword){
throw new Error("Invalid credentials");
}
Source code: github.com/Giacomorue/userauth
Instagram: www.instagram.com/giacomo.ruetta/
🚀 Ready to take your Next.js authentication skills to the next level? Hit play and let's get started! Don't forget to like, share, and subscribe for more in-depth tutorials. Happy coding! 🚀
#nextjstutorial #nextjs13 #nextjs #authjs #prisma #mongodb #react #javascript #programming
8 ماه پیش
در تاریخ 1402/10/14 منتشر شده
است.
2,103
بـار بازدید شده