-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
passport.authenticate('local', { successReturnToOrRedirect: '/'}) not working properly #919
Comments
Having the same problem since updating from v0.5.3. I believe this is down to change a77271f55f045bd4fd2578a953256406b3621721 - A workaround is to use passport.authenticate('oauth2', {
successReturnToOrRedirect: '/home',
failureRedirect: '/sign-in',
keepSessionInfo: true
}) though this feels like it defeats the purpose of regenerating the session, when all we want to keep is the Plus, if you are using Typescript |
We tried moving to 0.6.0 to receive vulnerability fixes but hit with this issue. Since the PR is all ready can we expect a release |
@Evalife @ashishth09 Did this solve your issue? i added keepsessioninfo to the config and its still having the same behavior |
@sbsamaro no it didn't solve for me either |
Same problem. Hope #941 could fix this. |
This patch should fix the broken redirect behaviour of the authentication provider where users aren't redirected back to the note they were send off, due to passport forgetting its session. Reference: jaredhanson/passport#919
This patch should fix the broken redirect behaviour of the authentication provider where users aren't redirected back to the note they were send off, due to passport forgetting its session. Reference: jaredhanson/passport#919 Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
const router = require('express').Router()
const User = require('../models/user.model')
const { body, validationResult } = require('express-validator')
const passport = require('passport')
router.get('/login', ensureNotAuthenticated, async(req, res, next) => {
res.render('login')
})
router.post('/login', ensureNotAuthenticated,
passport.authenticate('local', {
successReturnToOrRedirect: '/',
failureRedirect: "/auth/login",
failureFlash: true
}))
if for example a user tries to access a protected route, say 'auth/profile', he gets redirected to the log in page, but on successfully logging in, he gets redirected to the route specified in 'successReturnToOrRedirect'. I was using passport 0.4.1 and there, it redirected back to the previous protected route after the user has successfully logged in
The text was updated successfully, but these errors were encountered: