bnoguchi/mongoose-auth

Documentation for accessing user outside of a view

Closed this issue · 4 comments

everyauth.user is undefined unless you're in a view.

This information is in the README. The README specifies that everyauth.user is a view helper. If you want user in the context of a request handler (with access to req), then you can use req.user to access the user.

Ah, well there it is, req.user. I swear I read the entire README and didn't find that.

Thanks!

Yeah, maybe I should re-write in a manner to make it stand out more.

I have a similiar issue. The problem is that my "req.user" is always undefined. Even if I define a "findUserById function" (will never executed). I would appreciate that if you have the time to look at my app.js: https://gist.github.com/1247956 - Thank you very much in advance.