Closed YasharF closed 1 year ago
It is because of changes in passport 0.6 - https://medium.com/passportjs/fixing-session-fixation-b2b68619c51d
The other major change is that that req.logout() is now an asynchronous function, whereas previously it was synchronous. For instance, a logout route that was previously:
app.post('/logout', function(req, res, next) { req.logout(); res.redirect('/'); });
should be modified to:
app.post('/logout', function(req, res, next) { req.logout(function(err) { if (err) { return next(err); } res.redirect('/'); }); });
As with logging in, logging out also clears session information. The keepSessionInfooption can be passsed to req.logout() to override this.
node:events:491 throw er; // Unhandled 'error' event ^
Error: req#logout requires a callback function at req.logout.req.logOut (/mnt/c/temp/a/hackathon-starter/node_modules/passport/lib/http/request.js:65:44) at /mnt/c/temp/a/hackathon-starter/controllers/user.js:236:9 at /mnt/c/temp/a/hackathon-starter/node_modules/mongoose/lib/model.js:5353:18 at process.processTicksAndRejections (node:internal/process/task_queues:77:11) Emitted 'error' event on Function instance at: at /mnt/c/temp/a/hackathon-starter/node_modules/mongoose/lib/model.js:5355:15 at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Node.js v18.16.1