I have a simple express webapp and I am trying to add auth. Everything seems to work fine, I see the connect.sid in the cookies etc, but when I tried to access the following endpoint...
this.app.get("/user",
ensureLoggedIn("/login"),
function(req, res) {
res.json(req.user || {});
});
It redirects me to login instead of letting me through. What am I missing?
When I debug I can see that the problem is req.isAuthenticated is false. I am not sure why because I login and see the cookie. I can also logout and be presented with the Login screen so I am confused.