Passport-local: passport.deserializeUser called multiple times

Created on 22 Jun 2012  ·  3Comments  ·  Source: jaredhanson/passport-local

I'm new to passport and just ran the login example on my local machine.
When I log in as 'bob', password.serializeUser and password.deserializeUser are called.
Thats fine, but why is password.deserializeUser called two times?
How can I cache the user, so I don't have pull him from the db every time password.deserializeUser is called.

Most helpful comment

See Issue #14 on passport, and specifically this comment for the solution.

All 3 comments

See Issue #14 on passport, and specifically this comment for the solution.

@jaredhanson serializeUser should only be called once right, when user is authenticated???

When I was debugging multiple deserializeUser calls I found that my issue was chrome requesting source map files which did not exist. These calls resulted in 404 pages which would deserialize the user
for the header links.

These requests did not show up in the chrome network tab which made things more confusing.

The following debugging steps helped me uncover the issue:
https://github.com/jaredhanson/passport/issues/83#issuecomment-12340041

Was this page helpful?
0 / 5 - 0 ratings