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

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…

Contents