1

I'm using ExpressJS and have been trying to get PassportJS working. In my express.js config, I have the following:

app.configure(function () {
        // dynamic helpers
        app.use(helpers(config.app.name));

        // cookieParser should be above session
        app.use(express.cookieParser());

        // bodyParser should be above methodOverride
        app.use(express.bodyParser());
        app.use(express.methodOverride());

        // express/mongo session storage
        app.use(express.session({
          secret: 'noobjs',
          store: new mongoStore({
            url: config.db,
            collection : 'sessions'
          })
        }));

        // connect flash for flash messages
        app.use(flash());

        // use passport session
        app.use(passport.initialize());
        app.use(passport.session());

...

Unfortunately, I get the following error when I run the app:-

store.on('disconnect', function(){ storeReady = false; });
^
TypeError: Object #<Object> has no method 'on'

I think it has something to do with initialization order, but am too inexperienced around express to know what the order should be.

Can anyone offer some direction please?


There's an example in the Spring Security Core docs that uses passwordEnconder, but springSecurityService.encodePassword is fine too.

4

1 に答える 1

1

npmお尻を噛んだ。間違ったパッケージを降ろしました。問題が解決しました。

参考までに、これの正しいパッケージはnpm install connect-mongo.

于 2013-03-31T23:11:55.973 に答える