jfromaniello / passport.socketio

access passport.js authenticated user information from socket.io connection
655 stars 81 forks source link

Not specifying fail breaks Socket.io entirely #144

Open kylecombes opened 5 years ago

kylecombes commented 5 years ago

Using deps

and not specifying ~success and~ fail, Socket.io breaks entirely without any error for me.

The solution for me was to simply copy and paste in the sample code from the README.

It seems as though accept(err, result) instead of accept() may be the correct approach for Socket.io >= v2, since that is what it ends up running with the code copied from the README and left unmodified. Just my guess though.

kylecombes commented 5 years ago

Never mind, it doesn't fail anymore. This must've been related to another issue I was facing.

kylecombes commented 5 years ago

OK, the issue came back. It seems that something in the default for fail is not working. Putting in the following for fail fixes it, and commenting it out breaks it again:

(data, message, error, accept) => {
      if (error) {
        throw new Error(message);
      } else {
        accept(null, false);
      }
    }