Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DmitrKulagin opened this issue Aug 29, 2023 · 1 comment
Open

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

DmitrKulagin opened this issue Aug 29, 2023 · 1 comment

Comments

@DmitrKulagin
Copy link

DmitrKulagin commented Aug 29, 2023

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;
}
});

@SundaramMaheshkumar
Copy link

Check whether this is of any help. Thanks

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

No branches or pull requests

2 participants