https://supertokens.com/ logo
#support-questions
Title
# support-questions
k

kakashi_44

08/12/2021, 10:24 PM
Hi @User, we use cookies to authenticate a user. I think, the way you can authenticate a user via websocket is during the on connection event where the request object is available (I've checked this for ws library). If an active user session is present, the required cookies will be present in the request headers given that your API server and websocket server are on same domain. But the getSession function of node lib (https://supertokens.io/docs/nodejs/session/getsession) takes express request and express response object as parameter. So I'm not sure if it can be done that easily. You can use express-ws so the request will be of type express.Request. For response, you can create a dummy response of type express.Response. I suggest you create an issue regarding this in supertokens-node library
8 Views