Answer the question
In order to leave comments, you need to log in
How to solve authorization problem in Socket.io?
I have express authorization written (via passport.js), sockets receive authorization via passport.socketio when calling io.use:
io.use(passportSocketIo.authorize({
cookieParser: cookieParser,
key: 'express.sid',
secret: 'keyboard cat',
store: sessionStore,
}));
Answer the question
In order to leave comments, you need to log in
When you connect in the next tab, you open a new connection with authorization.
As an option:
1. Do not let the user in another time. When entering a new window, either disconnect the old connection or report that it is already connected.
2. Send a request to the user that he has logged out, and accordingly log him out in all his sockets.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question