-
Notifications
You must be signed in to change notification settings - Fork 524
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unauthorized Login with wrong password #18
Comments
Glad I'm not the only one. Thank you for sharing @basuabhirup ! Let me share my solution as well. I just use their Custom Callback example: app.post('/login', function(req, res, next) { |
I've came across the same issue. Thanks a lot for sharing the solution, @basuabhirup! |
I think the problem is login in a user before you authenticate them.
|
As reported by some of our fellow students. The issue is something like this:
Go to
localhost:3000/secrets
--this should reroute you to the
login
page because you are not authenticated yet.Login with the CORRECT email BUT USE AN INCORRECT PASSWORD.
--You won't be redirected to the
/secrets
route.Now manually go into
localhost:3000/secrets
--you should have access to the secrets page now despite having entered the wrong password.
I have the following suggestion to fix this issue by modifying the handler function of
POST
requests made on the/login
route::As the official documentation page of passportJS says - "calling
passport.authenticate()
middleware invokesreq.login()
automatically", hence no need to call it separately before authenticating, leaving a glitch for unauthorized access.The text was updated successfully, but these errors were encountered: