Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

success callback not called #123

Open
marcogreselin opened this issue Aug 3, 2016 · 1 comment
Open

success callback not called #123

marcogreselin opened this issue Aug 3, 2016 · 1 comment

Comments

@marcogreselin
Copy link

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)
    })
});
@jfromaniello
Copy link
Owner

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants