Next-Auth Login Authentication Tutorial with Next.js App Directory

Dave Gray July 1, 2023
Video Thumbnail

About

Web Development tutorials with full courses on HTML, CSS, JavaScript, React, Node.js and more! My goal is to help you learn how to build the web. Teaching helps me learn, too. I work full-time as a Solutions Architect / Developer and part-time as a university web dev instructor. Thank you for subscribing, supporting my channel and sharing the videos you think may help others. Keep striving for progress over perfection. And a little progress every day goes a very long way. Milestones: July 20, 2020 - 1st video Jan 1, 2021 - 1k subs April 2021 - 4k watch hours Nov 2021 - 10k subs Jan 21, 2022 - Video at 100k views Feb 16, 2022 - 100k watch hours Feb 19, 2022 - 1m views Dec 13, 2022 - 100k subs Dec 2022 - Over 1m views in 1 month April 7, 2023 - 10m views May 26, 2023 - 1m watch hours Sept 22, 2023 - Video at 1m views Dec 25, 2023 - 250k subs

Video Description

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap In this Next-Auth login authentication tutorial with Next.js app directory, you will learn how to protect all of your pages with credentials or an OAuth login from providers like GitHub. Learn how to protect any page in your app. **Get CodiumAI for FREE:** https://marketplace.visualstudio.com/items?itemName=Codium.codium or visit: https://www.codium.ai/ 💖 Support me on Patreon ➜ https://patreon.com/davegray ⭐ Become a full-stack web dev with Zero To Mastery Courses: - Complete Next.js Developer: https://bit.ly/CompNextJSDev - Advanced React: https://bit.ly/AdvReactDev - Junior to Senior Dev Roadmap: https://bit.ly/WebDevRoadmap-JrtoSr 🚩 Subscribe ➜ https://bit.ly/3nGHmNn 📬 Course Updates ➜ https://courses.davegray.codes/ ❓ Questions - Please post them to my Discord ➜ https://discord.gg/neKghyefqh ☕ Buy Me A Coffee ➜ https://www.buymeacoffee.com/davegray 👇 Follow Me On Social Media: Github: https://github.com/gitdagray Twitter: https://twitter.com/yesdavidgray LinkedIn: https://www.linkedin.com/in/davidagray/ 🔗 Source Code: https://github.com/gitdagray/next-auth-intro Next-Auth Login Authentication Tutorial with Next.js App Directory (00:00) Intro (00:05) Welcome (00:28) CodiumAI (01:39) Create Next.js Project & Dependencies (02:21) NextAuth.js Introduction (04:20) Auth Route Handler (05:49) NextAuth options (10:13) NEXTAUTH_SECRET (11:52) Setting up GitHub OAuth (16:09) Configuring Providers in options (23:08) Send a GET request to /api/auth/providers (25:06) App Behavior for 3 different server pages (26:27) Apply NextAuth with Middleware (29:10) 3 Different Protection Approaches (31:14) NextAuth with Client Components (37:35) Next.js Images from an OAuth Provider (39:26) Wrap-up 📚 Tutorial References: 🔗 NextAuth.js Official Site: https://next-auth.js.org/ 🔗 Next.js Official Site: https://nextjs.org/ 🔗 ES7 React Snippets Extension: https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets Was this Next-Auth tutorial using the Next.js 13 App Directory helpful? If so, please share. Let me know your thoughts in the comments. #nextjs #next #auth

You May Also Like

Upgrade Your Home Gym

AI-recommended products based on this video

Loading...
Sperax 4 in 1 Walking Vibration Pad Treadmill, Walking Treadmill Pad for Home with Remote Control and APP Global Recycled Standard

Sperax 4 in 1 Walking Vibration Pad Treadmill, Walking Treadmill Pad for Home with Remote Control and APP Global Recycled Standard

(9,887)
$239.99$220.79
FREE delivery Fri, Mar 13
5K+ bought in past month
Loading...
Small Standing Desk Adjustable Height, Mobile Stand Up Desk with Wheels, 32 Inch Portable Rolling Desks for Walking Pad Treadmill Wood Rustic

Small Standing Desk Adjustable Height, Mobile Stand Up Desk with Wheels, 32 Inch Portable Rolling Desks for Walking Pad Treadmill Wood Rustic

(1,020)
$92.99
FREE delivery Mon, Feb 16
Loading...
Walking Pad Treadmill, Under Desk Treadmill for Home and Office with Remote Control, Portable 2.5 HP Walking Jogging Running Machine in LED Display

Walking Pad Treadmill, Under Desk Treadmill for Home and Office with Remote Control, Portable 2.5 HP Walking Jogging Running Machine in LED Display

(63)
$159.99
Prime
Loading...
TOPUTURE Foldable Walking Pad with Incline, 2 in 1 Folding Under Desk Treadmill for Home/Office, Portable Compact Treadmill with Remote Control, APP & LED Display, 300lbs Capacity

TOPUTURE Foldable Walking Pad with Incline, 2 in 1 Folding Under Desk Treadmill for Home/Office, Portable Compact Treadmill with Remote Control, APP & LED Display, 300lbs Capacity

(1,304)
$279.99
Prime
700+ bought in past month
Loading...
KEY2FUN Treadmills for Home, Walking Pad Treadmill, Portable Foldable Treadmill, Lightweight Folding Treadmill with 300 LBS Capacity, 3.0 HP Portable Foldable Walking Pad with LED Display

KEY2FUN Treadmills for Home, Walking Pad Treadmill, Portable Foldable Treadmill, Lightweight Folding Treadmill with 300 LBS Capacity, 3.0 HP Portable Foldable Walking Pad with LED Display

(3)
$299.99
PrimeFREE delivery Mon, Jun 16
Loading...
TOPUTURE Foldable Walking Pad with Incline, 2 in 1 Folding Under Desk Treadmill for Home/Office, Portable Compact Treadmill with Remote Control, APP & LED Display, 300lbs Capacity

TOPUTURE Foldable Walking Pad with Incline, 2 in 1 Folding Under Desk Treadmill for Home/Office, Portable Compact Treadmill with Remote Control, APP & LED Display, 300lbs Capacity

(1,304)
$279.99
Prime
700+ bought in past month
Loading...
Walking Pad Treadmill, Under Desk Treadmill for Home and Office with Remote Control, Portable 2.5 HP Walking Jogging Running Machine in LED Display

Walking Pad Treadmill, Under Desk Treadmill for Home and Office with Remote Control, Portable 2.5 HP Walking Jogging Running Machine in LED Display

(63)
$159.99
Prime
Loading...
Treadmill, FOUSAE 5 in 1 Foldable 7.5 MPH Treadmill for Home with App Compatible, 12 Programes, Powerful 2.5 HP Portable Walking Pad with Manual Incline, Magnetic Remote Control Double Operation

Treadmill, FOUSAE 5 in 1 Foldable 7.5 MPH Treadmill for Home with App Compatible, 12 Programes, Powerful 2.5 HP Portable Walking Pad with Manual Incline, Magnetic Remote Control Double Operation

(19)
$289.99
Loading...
Walking Pad with 9% Incline, FOUSAE 3 in 1 6.2 MPH Treadmill for Home with Double Frame 330 LB Weight Capacity, 2.5 HP Under Desk Walking Pad Treadmill with 12 HIIT Programs, Magnetic Remote Control

Walking Pad with 9% Incline, FOUSAE 3 in 1 6.2 MPH Treadmill for Home with Double Frame 330 LB Weight Capacity, 2.5 HP Under Desk Walking Pad Treadmill with 12 HIIT Programs, Magnetic Remote Control

(150)
$239.99
FREE delivery Mon, Jul 7
300+ bought in past month
Loading...
Walking Pad, FOUSAE 3 in 1 Max 6.2 MPH Treadmill for Home with Double Frame 330 LB Weight Capacity, Powerful 2.5 HP Wider Belt Walking Pad with 9% Incline, 12 HIIT Programes, Magnetic Remote Control

Walking Pad, FOUSAE 3 in 1 Max 6.2 MPH Treadmill for Home with Double Frame 330 LB Weight Capacity, Powerful 2.5 HP Wider Belt Walking Pad with 9% Incline, 12 HIIT Programes, Magnetic Remote Control

(114)
$239.99
300+ bought in past month
Loading...
MSI Clutch GM08 4200 DPI, Accurate Optical Sensor, Durable Build Quality, Adjustable Weight System, Dragon Scale Design Side Grips, On The Fly DPI Changing, Optical Wired Gaming Mouse with Red LED

MSI Clutch GM08 4200 DPI, Accurate Optical Sensor, Durable Build Quality, Adjustable Weight System, Dragon Scale Design Side Grips, On The Fly DPI Changing, Optical Wired Gaming Mouse with Red LED

(1,282)
$20.99
FREE delivery Sat, Jan 3 on your first order
100+ bought in past month
Loading...
Exercise Bike, SLUNSE 5-in-1 Stationary Bike For Home Workout, Foldable Exercise Bike With 16 Levels Adjustable Magnetic Resistance,10DB Super-Silent Indoor Cycling Bike with 350lbs Weight Capacity

Exercise Bike, SLUNSE 5-in-1 Stationary Bike For Home Workout, Foldable Exercise Bike With 16 Levels Adjustable Magnetic Resistance,10DB Super-Silent Indoor Cycling Bike with 350lbs Weight Capacity

(5)
$259.99
FREE delivery Mon, Jul 7
Loading...
Glofex Twister Arm Chest Trainer - Adjustable 60-90lbs Resistance Bar Home Gym,Strength Training Exerciser Equipment for Men,Portable Muscle Builder Chest Clip Muscle Workouts Device

Glofex Twister Arm Chest Trainer - Adjustable 60-90lbs Resistance Bar Home Gym,Strength Training Exerciser Equipment for Men,Portable Muscle Builder Chest Clip Muscle Workouts Device

(5)
$34.99
FREE delivery Sun, Jul 6 on your first order
Loading...
Smart Watch for Men Women Bluetooth Call, 1.85" HD Touch Screen Fitness Watch with Sleep Heart Rate Monitor, 112+ Sports Modes, IP68 Waterproof Activity Trackers for Android iOS, Black

Smart Watch for Men Women Bluetooth Call, 1.85" HD Touch Screen Fitness Watch with Sleep Heart Rate Monitor, 112+ Sports Modes, IP68 Waterproof Activity Trackers for Android iOS, Black

(89)
$21.98
FREE delivery Fri, Dec 19 on your first order
Loading...
Fitness Tracker with 24/7 Heart Rate Sleep Blood Oxygen Monitor,IP68 Waterproof Smart Watch,1.10''AMOLED Touch Color Screen,Step Counter Health Activity Trackers for Women Men

Fitness Tracker with 24/7 Heart Rate Sleep Blood Oxygen Monitor,IP68 Waterproof Smart Watch,1.10''AMOLED Touch Color Screen,Step Counter Health Activity Trackers for Women Men

(197)
$29.15
Prime
900+ bought in past month
Loading...
IMFRCHCS Fitness Tracker,Smart Watch with 1.47" Touch Display,137+Sport Modes Fitness Watch with Heart Rate Sleep Monitor, Step Counter,IP68 Waterproof Activity Trackers for Women Men

IMFRCHCS Fitness Tracker,Smart Watch with 1.47" Touch Display,137+Sport Modes Fitness Watch with Heart Rate Sleep Monitor, Step Counter,IP68 Waterproof Activity Trackers for Women Men

(87)
$29.99
FREE delivery Tue, Jul 8 on your first order
100+ bought in past month
Loading...
aycy Smart Watch for Men Women Bluetooth Call, 1.85" HD Touch Screen Fitness Watch with Sleep Heart Rate Monitor, 112+ Sports Modes, IP68 Waterproof Activity Trackers for Android iOS, Pink

aycy Smart Watch for Men Women Bluetooth Call, 1.85" HD Touch Screen Fitness Watch with Sleep Heart Rate Monitor, 112+ Sports Modes, IP68 Waterproof Activity Trackers for Android iOS, Pink

(164)
$27.98
FREE delivery Thu, Jun 19 on your first order
100+ bought in past month
Loading...
Invincible Fitness Agility Ladder Full Training Equipment Set, Improves Coordination, Speed, Power and Strength, Includes 10 Cones 4 Hooks and 3 Loop Resistance Bands for Outdoor Workout

Invincible Fitness Agility Ladder Full Training Equipment Set, Improves Coordination, Speed, Power and Strength, Includes 10 Cones 4 Hooks and 3 Loop Resistance Bands for Outdoor Workout

(2,076)
$34.88
FREE delivery Sat, Jun 28 on your first order
100+ bought in past month
Loading...
Figure 8 Fitness Resistance Band 3 Pcs, Elastic Rope Stretch Bands for Working Out, Foot, Leg, Arm, Back, Chest, Portable Home Office Training Exercise Stretcher for Yoga Pilates Physical Therapy

Figure 8 Fitness Resistance Band 3 Pcs, Elastic Rope Stretch Bands for Working Out, Foot, Leg, Arm, Back, Chest, Portable Home Office Training Exercise Stretcher for Yoga Pilates Physical Therapy

(2)
$15.99$8.90
FREE delivery Sun, Aug 10 on your first order
Loading...
6-Tube Pedal Resistance Band, Premium Elastic Tension Rope for Full Body Workout, Natural Latex Fitness Bands for Strength Training,Yoga Stretching Slimming Training, Home Gym Exercise Equipment

6-Tube Pedal Resistance Band, Premium Elastic Tension Rope for Full Body Workout, Natural Latex Fitness Bands for Strength Training,Yoga Stretching Slimming Training, Home Gym Exercise Equipment

(0)
$11.05$11.00
FREE delivery Aug 20 - 25
Loading...
Exercise Bike, SLUNSE 5-in-1 Stationary Bike For Home Workout, Foldable Exercise Bike With 16 Levels Adjustable Magnetic Resistance,10DB Super-Silent Indoor Cycling Bike with 350lbs Weight Capacity

Exercise Bike, SLUNSE 5-in-1 Stationary Bike For Home Workout, Foldable Exercise Bike With 16 Levels Adjustable Magnetic Resistance,10DB Super-Silent Indoor Cycling Bike with 350lbs Weight Capacity

(5)
$259.99
FREE delivery Mon, Jul 7
Loading...
Exercise Bike, MOSUNY 5-in-1 Stationary Bike With 10DB Super-Silent, Folding Exercise Bike with 16-Level Adjustable Magnetic Resistance, 350 LBS Indoor Cycling Bike For Home Workout

Exercise Bike, MOSUNY 5-in-1 Stationary Bike With 10DB Super-Silent, Folding Exercise Bike with 16-Level Adjustable Magnetic Resistance, 350 LBS Indoor Cycling Bike For Home Workout

(397)
$259.99
FREE delivery Sun, Aug 10
400+ bought in past month
Loading...
llano RGB Laptop Cooling Pad with Powerful Turbofan Gaming Cooler Radiator with Infinitely Variable Speed, Touch Control, LCD Screen, 3-Port USB Hub, Seal Foam for Notebook Computer 15-19in

llano RGB Laptop Cooling Pad with Powerful Turbofan Gaming Cooler Radiator with Infinitely Variable Speed, Touch Control, LCD Screen, 3-Port USB Hub, Seal Foam for Notebook Computer 15-19in

(1,404)
$129.99
Prime
200+ bought in past month
Loading...
Cervical Neck Pillow, Ergonomic Memory Foam Pillows for Neck Pain Relief with Breathable Pillowcase, Contour Neck Support Pillow for Side Back Stomach Sleepers, Odorless OEKO-TEX STANDARD 100

Cervical Neck Pillow, Ergonomic Memory Foam Pillows for Neck Pain Relief with Breathable Pillowcase, Contour Neck Support Pillow for Side Back Stomach Sleepers, Odorless OEKO-TEX STANDARD 100

(1,779)
$55.97$47.57
FREE delivery Thu, Mar 12
5K+ bought in past month
Loading...
AstroAI 27" Snow Brush and Detachable Ice Scraper with Ergonomic Foam Grip for Cars, Trucks, SUVs (Heavy Duty ABS, PVC Brush, Orange)

AstroAI 27" Snow Brush and Detachable Ice Scraper with Ergonomic Foam Grip for Cars, Trucks, SUVs (Heavy Duty ABS, PVC Brush, Orange)

(33,617)
$16.99
FREE delivery Sat, Jan 3 on your first order
3K+ bought in past month
Loading...
Cervical Neck Pillow, Memory Foam Pillows for Neck and Shoulder Pain Relief, 2 Heights Ergonomic Pillow with Breathable Ice Silk Cover, Neck Support Pillow for Side Back Stomach Sleepers, Odorless OEKO-TEX STANDARD 100

Cervical Neck Pillow, Memory Foam Pillows for Neck and Shoulder Pain Relief, 2 Heights Ergonomic Pillow with Breathable Ice Silk Cover, Neck Support Pillow for Side Back Stomach Sleepers, Odorless OEKO-TEX STANDARD 100

(362)
$55.99