From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
NextAuth setup - Next.js Tutorial
From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch
NextAuth setup
All right guys, so now we're going to get set up with NextAuth, which is an open source authentication solution for Next.js, and it's extremely powerful. It's very flexible. There's a lot of different providers, meaning you can log in with Google or GitHub or just a local strategy, which is what we're using, just the email password. There's so many different options, and in turn, there's a lot of configuration that kind of goes into this. There's basically an options object we need to create and add a bunch of stuff to, like our providers, some of the session information, the callbacks that run at certain times, what else, the pages. So we define our sign-in page and so on. So this video will have quite a bit in it, but it's just basic stuff that you can find in the docs. Like I said, we'll be using the credentials strategy, or I'm sorry, credentials provider. So we just need to define some stuff in that options file. And then those options are used in a route that we need to create…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Section intro2m 57s
-
(Locked)
Prisma user-related models9m 45s
-
(Locked)
Seed user data7m
-
(Locked)
NextAuth setup17m 31s
-
(Locked)
NextAuth catch all API route4m 12s
-
(Locked)
Sign-in and sign-out server actions8m 27s
-
(Locked)
Auth layout and sign-in page6m 58s
-
(Locked)
Credentials sign-in form6m 39s
-
(Locked)
Hook up sign-in form9m 28s
-
(Locked)
Callback URL redirect4m 26s
-
(Locked)
User button and sign-out11m 48s
-
(Locked)
Signup Zod schema and action8m 15s
-
(Locked)
Sign-up page and form7m 35s
-
(Locked)
Sign-up error handling12m 40s
-
(Locked)
Customize token with JWT callback8m 19s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-