Coder Social home page Coder Social logo

Access to User db object about mongoose-auth HOT 6 CLOSED

bnoguchi avatar bnoguchi commented on August 11, 2024
Access to User db object

from mongoose-auth.

Comments (6)

 avatar commented on August 11, 2024

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

{
  "lastAccess":1303841289370,
  "cookie":{
    "originalMaxAge":14400000,
    "expires":"2011-04-26T22:07:38.878Z",
    "httpOnly":true,
    "path":"/"
  },
  "auth":{
    "facebook":{
      "user":{
        "id":"610771581",
        "name":"Jason Bond Pratt",
        "first_name":"Jason",
        "middle_name":"Bond",
        "last_name":"Pratt",
        "link":"http://www.facebook.com/jasonbondpratt",
        "username":"jasonbondpratt",
        "hometown":{
          "id":"107442005952063",
          "name":"Hartford, Michigan"
        },
        "location":{
          "id":"110184922344060",
          "name":"Washington, District of Columbia"
        },
        "gender":"male",
        "email":"[email protected]",
        "timezone":-4,
        "locale":"en_US",
        "verified":true,
        "updated_time":"2011-04-16T22:09:12+0000"
      },
      "accessToken":"XXXXXXXXXXXXXXXXXXXXX"
    },
    "loggedIn":true
  }
}

from mongoose-auth.

bnoguchi avatar bnoguchi commented on August 11, 2024

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

from mongoose-auth.

bnoguchi avatar bnoguchi commented on August 11, 2024

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

from mongoose-auth.

 avatar commented on August 11, 2024

AWESOME.

from mongoose-auth.

 avatar commented on August 11, 2024

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.

from mongoose-auth.

bnoguchi avatar bnoguchi commented on August 11, 2024

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.

from mongoose-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.