Next.js middleware with NextAuth server session?
What is the best way to write a Next.js middleware (middleware.ts) that redirects to /login if the user is not logged in? I'm using the t3 stack with db sessions
2 Replies
Securing pages and API routes | NextAuth.js
You can easily protect client and server side rendered pages and API routes with NextAuth.js.
It only supports jwt sessions, im using db sessions