Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextAuth middleware incorrectly blocking authenticated users #5096

Closed
burstWizard opened this issue Aug 5, 2022 · 2 comments
Closed

NextAuth middleware incorrectly blocking authenticated users #5096

burstWizard opened this issue Aug 5, 2022 · 2 comments
Labels
question Ask how to do something or how something works

Comments

@burstWizard
Copy link

Question 馃挰

I'm integrating NextAuth into my web app and facing an issue with protecting specific pages. I have followed the docs here: https://next-auth.js.org/configuration/nextjs#middleware. When I visit a "restricted" page, even when I have authentication, it redirects me back to the login page. I can't ever get into the "restricted" page.

I know the user is correctly logged in because pages that are not protected are accessing user data just fine.

I am only using Google OAuth, no email, no other providers.

How to reproduce 鈽曪笍

middleware.js at root like so:

export { default } from "next-auth/middleware"

export const config = { matcher: ["/student/account"] }

Set a NEXTAUTH_SECRET in .env using openssl generated string.

Visit /student/account after logging in, you will see that you are bounced back to the login page.

Contributing 馃檶馃徑

No, I am afraid I cannot help regarding this

@burstWizard burstWizard added the question Ask how to do something or how something works label Aug 5, 2022
@balazsorban44
Copy link
Member

Likely a duplicate of #5008

@burstWizard
Copy link
Author

Thank you!, I'll wait for a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask how to do something or how something works
Projects
None yet
Development

No branches or pull requests

2 participants