Help with NextAuth middleware page protection! #5095
Unanswered
burstWizard
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm integrating nextauth into my web app, and ran into trouble with page protection using middleware. I have, at my root, a middleware.js file that contains:
as per [https://next-auth.js.org/configuration/nextjs#middleware]
I've also setup the NEXTAUTH_SECRET environment variable with a string generated using openssl.
When I try to access /student/account, it redirects me to the login page. However, it does this even when I am logged in. I know that the user is logged in properly because non-protected pages are accessing and using user data just fine.
What can I be doing wrong? My code follows what the docs say to do.
Beta Was this translation helpful? Give feedback.
All reactions