Join our mailing list Subscribe Us

npm package passport.js upgrade (0.4.1 to 0.6.0) issue

1 min read



--> In this upgrade i faced issue with the versions which i was using for passport. I should have modified all the places with new passport version.

--> secondly it started showing the Logout issue, as per documentation from passport they said signature for logout function got changed and new implementation is based on async hence new logout will expect the callback function.

below is the new signature, 

req.logout(
    function(err) { 
        if (err) { 
            return next(err); 
        }
     res.redirect('/'); 
});

old signature was,
req.logout();
res.redirect('/'); 

--> thirdly i faced issue of 
"Login sessions require session support. Did you forget to use express-session middleware?"

here i needed to use the new npm package `express-session` and need to add code to use express-session as middleware. 
code i need to add:
var session = require('express-session'); 

app. app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: false,
cookie: { secure: true } }));
}));

doc link: https://www.passportjs.org/concepts/authentication/sessions/
More info about session: https://medium.com/passportjs/fixing-session-fixation-b2b68619c51d
one more workaround mentioned in github: https://github.com/jaredhanson/passport/issues/939


You may like these posts

  • --> In this upgrade i faced issue with the versions which i was using for passport. I should have modified all the places with new passport version.--> secondly it started sh…
  • How to install OS on Samsung Galaxy S Duos 2Download and Install Lineage OS 15 On Samsung Galaxy S Duos 2 (GT-S7582) | Android 8.0 Oreo: Update Samsung Galaxy S Duos 2 (GT-S7582) T…
  • Guide to install GIT: Basic guide to installing Git on various operating systems:WindowsDownload the Git Installer: Go to the Git for Windows page and download the installer.Run th…
  •  How to install ANT on Mac OS in few easy steps. Apache Ant is Java library and command line tool used to “build” or run tasks. It’s pretty popular in the Java Community …