0
votes

I'm following this guide for implementing Passport for signup:

https://scotch.io/tutorials/easy-node-authentication-setup-and-local

Everything works well, except that Passport does not redirect on successful signup. This is my code that I'm using to redirect on a successful signup:

//  POST        /signup
router.post('/signup', passport.authenticate('local-signup', {
    successRedirect : '/dashboard',
    failureRedirect : '/signup',
    failureFlash: true
}));

I have verified that the user is created in the database. failureRedirect works! It's just on successRedirect that the web page hangs like it's not being successfully redirected.

Is there an incompatibility issue with passport and Express 4 Router? I see all examples of Passport using app.post() instead of router.post().

Thanks!

1

1 Answers

3
votes

It looks like you're deviating from the tutorial in that you're using successRedirect to go to a page called dashboard, not profile. Have you updated your app/routes.js file to reflect that ? app.get('/dashboard', isLoggedIn, function(req, res) {...}