jfromaniello/passport.socketio

success callback not called

Opened this issue · 1 comments

Hello! I have the following code but for some reason the success callback is never called. Instead the fail callback is always called. However, when I emit logon from the client, I see socket.request.user.companyid printed out in the console which suggests the user is correctly authenticated. What am I missing?

io.use(passportSocketIo.authorize({
    key: 'connect.sid',
    secret: 'whatever',
    store: sessionStore,
    cookieParser: cookieParser,
    success:      onAuthorizeSuccess,
    fail:         onAuthorizeFail
}));


function onAuthorizeSuccess(data, accept) {
    console.log('An agent connected'+JSON.stringify(data));
    accept();
}

function onAuthorizeFail(data, message, error, accept) {
    console.log('A banner connected')
    accept(null, !error);
}

io.on('connection', function(socket){
    console.log('a user connected');
    socket.on("logon", function () {
      console.log(socket.request.user.companyid)
    })
});

Can you show me what are the parameters the fail function is being called? (sorry for the delay)