Local passport authorization on different ports <p>I have a node.js application running on port 5000, where I use passport.js as authorization. I authorize users from a post request, where I use a custom callback:</p> <pre><code>this.router.post('/member/login', (req, res, next) =&gt; { passport.authenticate('local', (err, member, info) =&gt; { if (err) res.json(400).json({message: "An error ocurred"}); if (!member) { console.log("No member found!"); return res.status(409).json({message: "No member found!"}) } req.logIn(member, (err) =&gt; { if (err) { console.log(err); return res.status(400).json({message: "An error ocurred"}); } return res.json(member); }); })(req, res, next); }); </code></pre> <p>This works fine, but when I develop local I have a frontend Angular2 application, which runs on a different port (4200), so in my development I am not possible to get the authorized user: req.user is undefined. I use express-session to store the authorized user.</p> <p>When I deploy I bundle both applications up together, so everything works. </p> <p>Does anyone have a good and simple solution for this issue? Again it's only in development I have this problem.</p>