how to get the session outside a component
Unanswered
subscr posted this in #help-forum
subscrOP
Hey guys, I want to get a user's session outside of a component, is it possible?
I was wanting to get the session, to send the user ID as auth in websocket.
I was wanting to get the session, to send the user ID as auth in websocket.
12 Replies
subscrOP
If you need some code, I'll send you the way I'm doing it, using sessionStorage, but in the build it doesn't build.
@subscr you need to describe in more detail so that we can help
subscrOP
ok, wait
basically, I want to take the user ID and put it in this token:
but, it is not possible to use sessionStorage outside of a component
This sessionStorage takes the ID of the current session, in this case
well sessionStorage is only available in browser environment
subscrOP
so this is the problem and I don't know how I can change this to get the current session id.
are you using socket.io?
subscrOP
ye
@James4u are you using socket.io?
subscrOP
Another thing, I wanted to encrypt this token, do you know what I can do to get it and do that?
subscrOP
@James4u dyk what i can do?