Next Auth middleware redirects me to the login page, even if there's a session
I am busting my head around this thing. I tried to setup NextJS with NextAuth, Drizzle and PlanetScale. So I am not using the T3-scaffold. The thing is that I can see that there's a user returned from
getServerSession
. But when I add my middleware.ts file. It just keeps redirecting me to the login page. As if there would be no session the middleware could recognize.
Any ideas to why?3 Replies
what does your middleware.ts look like?
Well right now the regular exported function with the withAuth stuff. Also have matcher. But if I remove the matcher, then I can't (of course) visit any page.
you cannot use next-auth's session with nextjs's middleware, you have to use jwt