suggestion
While i was working on the serialization challenge i felt a little bit lost because i understood what serialization did, but i didn’t understood when or how it was applied.
It could be helpful to add an explanation that serialization is automatically applied by passport during authentication, and that deserialization is applied by passport before every request in the passport.session()
middleware so it goes like this:
- we do a request.
passport.sesion()
middleware is executed, it deserializes data (and also adds the user’s data toreq.user
).app.route('/whatever').httpMethod(callback)
is executed and we have our data deserialized inreq.user
.
It could add a little bit of clarity.
Challenge: Implement the Serialization of a Passport User
Link to the challenge: