Sunday, 16 April 2017

Node.js: Using passport, is it albe to customize the temporary value which saved by serialize function?

We know that the passport will keep the authenticate result in the req.user by using

passport.serializeUser(function(user, cb) { cb(null,user); })

I'm try to return the result and the status code from the server. In order to get both of them, I'm trying to find a way to save those two in different vessel. For example down below.

passprot.serializer____(function(statuscode, user, cb) { cb(null, user, statuscode); } )

In the customized serializer above, it saved the result in req.user and the statuscode in req.___ (save status code). However, the way I used now is to saved them both in req.user.



via Eric Chang

No comments:

Post a Comment