Answer the question
In order to leave comments, you need to log in
Session fails in cookie parser?
Hello, in order to authorize users when working through tips, I try to check the session through the cookie parser module , namely the cookieParser.signedCookie(str, secret) method
io.use(function(socket, next) {
var handshakeData = socket.request;
handshakeData.cookies = cookie.parse(handshakeData.headers.cookie || '');
var sidCookie = handshakeData.cookies[config.session.name];
var sid = cookieParser.signedCookie(sidCookie, config.session.secret);
console.log(sid)
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question