bnoguchi / mongoose-auth

User authentication plugin for mongoose nodejs orm

Home Page:https://github.com/bnoguchi/mongoose-auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to get session from connect-mongo session store

dworrad opened this issue · comments

This doesn't seem to work on heroku when Env is production.... req.loggedIn comes back as false- even though the session is created and looks good in the mongo instance... Any ideas why? The log messages are below the code.

var app = express.createServer(
express.bodyParser()
, express.static(__dirname + "/static")
, express.cookieParser()
, express.session({
secret: conf.session.secret
,store: new MongoStore({url: "my mongo url", reapInterval: 60000000 * 5})
,cookie: { secret: "MySecret", cookie: { path: '/', maxAge: 60000000 * 5 }}
})
, mongooseAuth.middleware()
);

app.configure( function () {
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.set("view options", { layout: "layout_narrow.ejs" });
//app.use(express.session({ store: new MongoStore({ db: 'test' }) }));
});

2012-02-03T10:20:34+00:00 app[web.1]: starting step - extractLoginPassword
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: starting step - authenticate
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: starting step - getSession
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: starting step - interpretUserOrErrors
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: starting step - respondToLoginSucceed
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: starting step - addToSession
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: ...finished step
2012-02-03T10:20:34+00:00 app[web.1]: starting step - respondToLoginFail

This suggests it first of all passed auth and then failed?? but no failure is sent to the login form like you'd expect from a failure.

Thanks