jaredhanson / passport-local

Username and password authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-local/?utm_source=github&utm_medium=referral&utm_campaign=passport-local&utm_content=about
MIT License
2.74k stars 498 forks source link

Error running express3-mongoose-multiple-files #74

Closed oakley808 closed 9 years ago

oakley808 commented 10 years ago

Hi. The example "express3-mongoose-multiple-files" doesn't run for me on OSX. I get the following error

examples/express3-mongoose-multiple-files/config/pass.js:40
  console.log(req.user);
                 ^
TypeError: Cannot read property 'user' of undefined
...

Maybe app needs to be passed to pass.js for req to be defined? The express3-mongoose example seems to work fine.

(I'm using Express 3 and Node v0.10.26)

oakley808 commented 10 years ago

Actually, maybe it's the example app.js file line 34.

app.get('/admin', pass.ensureAuthenticated, pass.ensureAdmin(), user_routes.admin);

Maybe should be:

app.get('/admin', pass.ensureAuthenticated, pass.ensureAdmin, user_routes.admin);

?

jaredhanson commented 9 years ago

To reduce the noise of issues filed against examples, I'm moving examples to separate repositories. Please feel free to take ownership of this example by creating a new repo and adding it to the wiki here: https://github.com/jaredhanson/passport-local/wiki/Examples