Closed jackdreinhardt closed 4 years ago
App uses passport.js for auth uh its complicated - might want to come by our development channel on discord for this one. I would start by debugging from the nodejs side. Take a look at the user-requests
file specifically.
I've found some time to dig into this and have taken a look at passport.js
and the user-requests
file but am still not sure how to proceed. I see that using the local strategy
is preferred, but I am not sure how to proceed. I noticed the use of socket.handshake.session
from the express-socket.io-session
package. Would it be possible to utilize this to get proper authentication?
Resolving in Discord channel
Hi,
I am working on a project to create an intelligent agent (bot) to play SH based on the DeepRole algorithm. The bot must be able to take actions during the game – voting, picking a chancellor, etc – and get the game state. I plan to use the websocket connection to do this, but I am running into some problems.
After running
yarn dev
andyarn create-accounts
, running the code below connects successfully to the socket, receives thefetchUser
event, and emits thesendUser
event with the specified user. (I am new to javascript, so please forgive any stylistic sins)However, the server responds with an empty user list:
socket.io-client:socket emitting event ["userList",{"list":[]}] +0ms
.Running
DEBUG=socket.io-client:socket,socket.io-client:manager node client.js
gives the following output:I have hypothesized that I am running into an auth problem and have tried to add the
connect.sid
cookie the user receives from/account/signin
. This modification did not change the result of the above code (I did that version in python using thepython-socketio
module as I am more familiar with the language). I have been digging through the codebase trying to figure out how to authenticate the bot, but have been unable to come up with a solution.If it's possible, how do I correctly authenticate a (bot) user to fully utilize the websocket? Any help is greatly appreciated, thanks.
TL;DR The client can connect successfully to the socket, but the server does not receive client events correctly. E.g. emitting a
sendUser
event does not result the expecteduserList
. Authentication problem?