Next.js + NextAuth protect all routes
I want my users to be redirected to NextAuth login page if they try to access any routes in my Next app.
I tried adding middleware
export { default } from "next-auth/middleware"
But this doesn't really work because I get redirected to login page even after I log in2 Replies
check if there's a session in the server side on the routes you want (why do you want to redirect on all the routes that doesnt make sense), if there's no session redirect to login
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View