Skip to content

Give NextAuth access to a catch-all

Course: Next Auth - chapter 5

Ref https://next-auth.js.org/configuration/initialization#route-handlers-app

  1. Create /api/auth/[…nextauth]/route.ts
  2. Install next-auth
npm install next-auth
  1. Updated handler
import NextAuth from "next-auth"
const handler = NextAuth({
...
})
export { handler as GET, handler as POST }
  1. Adding providers - There are three broad types of providers
  2. OAuth (Login with google)
  3. Email (Passwordless Email login via email OTP)
  4. Credentials (your own strategy) Let’s them one by one