Closed andreivirabean closed 5 years ago
The issue was that the passport.deserializeUser wasn't called, after investigation I had to set
// Cross-Origin Resource Sharing (CORS) app.use(function (req, res, next) { res.header('Access-Control-Allow-Credentials', true); res.header('Access-Control-Allow-Origin', req.headers.origin); res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); res.header('Access-Control-Allow-Headers', 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept'); if ('OPTIONS' == req.method) { res.send(200); } else { next(); } });
In my server.js (app.js) file since it was a CORS problem (client running on 4200 and server on 3000).
withCredentials = true
I can't get the ensureAuthenticated to work properly :(
Problem:
Don't want to spam with code here (sorry if it's not allowed to post links to other repositories, but mine is entirely based on Brad's tutorial just with Angular on the Front-end side.
Link to the repository: https://github.com/andreivirabean/BookSharing
Any help is highly appreciated.