i want to use supertokens_python with websockets i...
# general
b
i want to use supertokens_python with websockets in fastapi. is there a verify_session that works for a websocket route?
r
Hey @BeeMoe
Not really. You can initiate a web socket with a route that uses the very session function. But authentication of each event during the socket connection should be done by yourself.
b
Oh
Actually, let me ask a better question. Using a websocket route, how do I get the user logged in?
r
There could be multiple ways. One is that you can create a JWT using Session.createJWT function which contains the user id.
And then pass that to the websocket event
Another would be to use the session’s handle and from that you can query the userId from supertoeks. This would require a db call though
b
Okay
Thank you
im gonna try the first way you said
looking at the docs i cant find where .createJWT is
@rp
r
See in session.syncio or session.asyncio package
b
thank you
5 Views