Socket.io sessionStore,store.get方法不存在

时间:2015-10-07 18:39:39

标签: javascript node.js mongodb session passport.js

我正在尝试使用Socket.io和passport.js

进行会话存储
var session = require('express-session');
var cookieParser = require('cookie-parser');
var MongoStore = require('connect-mongo')(session);
var sessionStore = session({
    store: new MongoStore({url: 'mongodb://localhost/RULE'}),
    key: 'express.sid',
    secret: 'Heisenberg'
});

// Socket.io auth
io.set('authorization', passportSocketIo.authorize({
    cookieParser: cookieParser,
    key: 'express.sid',
    secret: 'Heisenberg',
    store: sessionStore,
    success: onAuthorizeSuccess,
    fail: onAuthorizeFail,
}));

我收到此错误: TypeError: auth.store.get is not a function

所以我想这是connect-mongo商店实例的问题,但我不知道如何调试它或问题可能是什么。

0 个答案:

没有答案