Skip to content

io.socket.get 401 code for room connection #130

@DmitrKulagin

Description

@DmitrKulagin

Hey! My old project used io.socket.get to connect to secret rooms.

io.socket.get('/list/handshake', function (data, jwr) {
if (jwr.error) {
return;
}
});

io.socket.get('/terminal/handshake', function (data, jwr) {
if (jwr.error) {
return;
}
});

After auditing the packages, I received updates and am now getting a 401 error when trying to connect.

I'm assuming that it's necessary to pass cookie bitches and the io.socket.request method is more suitable for this, but I have a poor idea of what exactly the sails require to pass the request authorization. Who faced a similar problem and what solution can work?

io.socket.request({
method: 'get',
url: '/list/handshake',
headers: {
// cookie: document.cookie,
'x-csrf-token': window.SAILS_LOCALS._csrf ? window.SAILS_LOCALS._csrf : '',
}
}, function (data, jwr) {
if (jwr.error) {
return;
}
});

io.socket.request({
method: 'get',
url: '/terminal/handshake',
}, function (data, jwr) {
if (jwr.error) {
return;
}
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions