node.js - In passportjs deserialization, store sesssion data in browser cookie -
In the ordering and deserialization of passports, how do I store browser cookies instead of storage (I am constantly submitting session data on browser cookies ) How to use the database in
If you have correctly configured passport middleware Passport session data will be passed as the passport parameter of the method. DeserializeUser.
Ensure that the passport is set correctly in Express:
app.us (express.cookieParser ()); App. (Express: (secret: 'your secret phrase'})); App.use (passport.initialize ()); App.use (passport.session ()); implementation passport. Cyrilize user and passport.deserializeUser : // User includes user passport by data validation strategy Cyrilize user (function (user, done) {done (tap, user);}); // obj passport session data passport.deserializeUser (function (obj, done) {// use obj to get user information or include it directly in the requested object (empty, obj);}); User data will be available in req.user .
Comments
Post a Comment