N
N
nurdus2017-09-24 21:39:00
Node.js
nurdus, 2017-09-24 21:39:00

Is it possible to just do(null, user) in the serializeUser/deserializeUser functions in passport.js?

Good evening.
Can serializeUser and deserializeUser just return user? Doing nothing with it?

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

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Gerasimov, 2017-09-24
@nurdus

It is possible, but in theory you do not store the user'a object, but its identifier, by which in deserializeUser you request it from the source (for example, a database), then the data is relevant within the request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question