Access to User db object #6

tixelated opened this Issue Apr 26, 2011 · 6 comments

2 participants


Hey there - wondering how to get access to the actual DB User record that's linked to the facebook/twitter/etc account info. That is, once a user logs in (using, say, facebook,) I know I can get at their facebook info from req.session.auth.facebook, but not that actual user record.

I just wanted to check and make sure there isn't a way already built to do this before getting into querying for that user record via the facebook embedded document, which is otherwise the only way I know how to do it...


More info - my req.session after a successful facebook authentication looks like this:

        "name":"Jason Bond Pratt",
          "name":"Hartford, Michigan"
          "name":"Washington, District of Columbia"

Rolling out a req.user accessor within the hour. Stay tuned.


npm install the latest v0.0.6

From your express server code, you now will have access to req.user

From your express views, you now will have access to both

  • everyauth.user
  • user

which equivalently return the mongoose User document associated with the current session

@bnoguchi bnoguchi closed this Apr 26, 2011



This is great - originally I had some problems, as I missed the update in everyauth that requires the findUserById function to be defined, works great now. That being said - maybe mongoose-auth could provide that definition by default, since it has access to the User model (via it's configurable User function) and knows that it's using Mongoose. Anyway just an idea.


mongoose-auth does provide a default findUserById definition. If you check the README, you do not have to define findUserById for mongoose-auth, since it does it for you automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment