Advanced Node and Express: Registration of New Users

Advanced Node and Express: Registration of New Users
0

#1

Hi. I’m having an issue on this challenge. I’ve set up my app.post('/register') route and am successfully creating a new user in my database. Then I authenticate the new user and attempt to redirect them to my '/profile' route. Before they can be routed to that page, you have to call ensureAuthenticated to make sure they’re logged in. Immediately prior to my res.redirect('/profile'), the user object is defined. However, once my request arrives at ensureAuthenticated, it’s undefined and my ensureAuthenticated fails. I can’t figure out why the redirect seems to be causing the user object to disappear. Thanks in advance for any help you can provide.


#2

Whoops, found it. Was searching for id in my deserializeUser instead of _id. Ugh