Next.js Auth Masterclass: Build Secure Login π
Learn to build authentication in Next.js from scratch, including Email, Password, and OAuth2, without using libraries. Try Clerk for easier setup.

Web Dev Simplified
105.4K views β’ Feb 25, 2025

About this video
Try Clerk: https://go.clerk.com/wds-auth
Building authentication from scratch is a daunting task which is why in this video I show you how to build a production ready authentication system with email/password, OAuth2, cookies, session management, and so much more. This is the ultimate authentication crash course.
π Materials/References:
GitHub Code: https://github.com/WebDevSimplified/custom-nextjs-authentication
π Find Me Here:
My Blog: https://blog.webdevsimplified.com
My Courses: https://courses.webdevsimplified.com
Patreon: https://www.patreon.com/WebDevSimplified
Twitter: https://twitter.com/DevSimplified
Discord: https://discord.gg/7StTjnR
GitHub: https://github.com/WebDevSimplified
CodePen: https://codepen.io/WebDevSimplified
β±οΈ Timestamps:
00:00:00 - Introduction
00:02:05 - Email/Password Diagram Explanations
00:09:09 - Starting Code
00:12:28 - Email/Password Sign Up
00:20:25 - Session Management
00:34:15 - Email/Password Sign In
00:37:55 - Logout Logic
00:40:25 - Advanced getCurrentUser Function
00:44:15 - Private Pages/Next.js Middleware
00:49:16 - Updating Session Data
00:56:43 - Clerk Setup
01:02:52 - OAuth Diagram Explanations
01:06:23 - Starting Code Updates
01:10:22 - Discord OAuth Setup
01:12:25 - OAuth Auth URL (Step 1)
01:21:05 - OAuth Access Token (Step 2)
01:30:45 - OAuth User Data (Step 3)
01:39:40 - Advanced OAuth Security (State)
01:44:00 - Advanced OAuth Security (Code Verifier)
01:47:29 - Making OAuth Client Generic
01:54:18 - GitHub OAuth
01:58:32 - Fixing Cookie Bug
#Authentication #WDS #NextJS
Building authentication from scratch is a daunting task which is why in this video I show you how to build a production ready authentication system with email/password, OAuth2, cookies, session management, and so much more. This is the ultimate authentication crash course.
π Materials/References:
GitHub Code: https://github.com/WebDevSimplified/custom-nextjs-authentication
π Find Me Here:
My Blog: https://blog.webdevsimplified.com
My Courses: https://courses.webdevsimplified.com
Patreon: https://www.patreon.com/WebDevSimplified
Twitter: https://twitter.com/DevSimplified
Discord: https://discord.gg/7StTjnR
GitHub: https://github.com/WebDevSimplified
CodePen: https://codepen.io/WebDevSimplified
β±οΈ Timestamps:
00:00:00 - Introduction
00:02:05 - Email/Password Diagram Explanations
00:09:09 - Starting Code
00:12:28 - Email/Password Sign Up
00:20:25 - Session Management
00:34:15 - Email/Password Sign In
00:37:55 - Logout Logic
00:40:25 - Advanced getCurrentUser Function
00:44:15 - Private Pages/Next.js Middleware
00:49:16 - Updating Session Data
00:56:43 - Clerk Setup
01:02:52 - OAuth Diagram Explanations
01:06:23 - Starting Code Updates
01:10:22 - Discord OAuth Setup
01:12:25 - OAuth Auth URL (Step 1)
01:21:05 - OAuth Access Token (Step 2)
01:30:45 - OAuth User Data (Step 3)
01:39:40 - Advanced OAuth Security (State)
01:44:00 - Advanced OAuth Security (Code Verifier)
01:47:29 - Making OAuth Client Generic
01:54:18 - GitHub OAuth
01:58:32 - Fixing Cookie Bug
#Authentication #WDS #NextJS
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
105.4K
Likes
3.8K
Duration
01:59:40
Published
Feb 25, 2025
User Reviews
4.7
(21) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.