bnoguchi / mongoose-auth

User authentication plugin for mongoose nodejs orm
https://github.com/bnoguchi/mongoose-auth
740 stars 113 forks source link

Error running example #129

Open MichaelJCole opened 11 years ago

MichaelJCole commented 11 years ago

Hey, I'm trying to run the example, but obviously doing it wrong.

Here's what I did:

git clone https://github.com/bnoguchi/mongoose-auth.git
cd mongoose-auth
npm install
cd example
node server.js

Here's what it did:

☔  node server.js                                                                                      master
Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:

  var express = require("express");
  var app = express();

everyauth.helpExpress is being deprecated. helpExpress is now automatically invoked when it detects express. So remove everyauth.helpExpress from your code
TypeError: /home/michaelcole/scm/mongoose-auth/example/views/home.jade:1
  > 1| - if (!everyauth.loggedIn)
    2|   h2 Not Authenticated
    3|   #register
    4|     a(href='/register') Register

Cannot read property 'loggedIn' of undefined
    at eval (eval at <anonymous> (/home/michaelcole/scm/mongoose-auth/node_modules/jade/lib/jade.js:170:8), <anonymous>:7:15)
    at /home/michaelcole/scm/mongoose-auth/node_modules/jade/lib/jade.js:171:35
    at Object.exports.render (/home/michaelcole/scm/mongoose-auth/node_modules/jade/lib/jade.js:205:14)
    at View.exports.renderFile [as engine] (/home/michaelcole/scm/mongoose-auth/node_modules/jade/lib/jade.js:232:13)
    at View.render (/home/michaelcole/scm/mongoose-auth/node_modules/express/lib/view.js:76:8)
    at Function.app.render (/home/michaelcole/scm/mongoose-auth/node_modules/express/lib/application.js:506:10)
    at ServerResponse.res.render (/home/michaelcole/scm/mongoose-auth/node_modules/express/lib/response.js:756:7)
    at /home/michaelcole/scm/mongoose-auth/example/server.js:111:7
    at callbacks (/home/michaelcole/scm/mongoose-auth/node_modules/express/lib/router/index.js:161:37)
    at param (/home/michaelcole/scm/mongoose-auth/node_modules/express/lib/router/index.js:135:11)

What am I doing wrong?

martinsookael commented 11 years ago

1) var app = express(); // that's fixable on line 98, with "var app = express.express.createServer(" to "var app = express("

2) everyauth.helpExpress is being deprecated - that's line 120. I just commented it out.

3) Cannot read property 'loggedIn' of undefined Well, that's why I'm here. UP.

NTTAKR commented 11 years ago

Well? Any more info on this?

MichaelJCole commented 11 years ago

Hey, I ended up using PassportJS. I think it's the new hawtness and better maintained. Please contradict me if mongoose-auth is still actively developed.

http://passportjs.org/

Unworthy self-link: https://github.com/MichaelJCole/passport-freshbooks