Two different user models using two different guards (session and token) authenticating both so they can connect to scokets. What options do I have?
Hi All, I have been working on an app and getting the real time aspect of this part has been really overwhelming so I thought i'd ask
Lets say I have two user models users and admins, user use the token guard and admins use the session guard. The reason is because users will have access to a mobile app.
To authenticate the users for socket connections I use the socket.io jwt package, that is clear to me.
-
To authenticate the admin side what I am thinking of doing is saving the session id when an admin logs in on redis. Then compare the session id on redis to the session on the browser when the user requests to connect to the socket.
-
Convert the admins to use JWT as well, I am so far along that if I do that now ill have to change a bunch of code. Plus using multi user models - i cant figure out how to use JWT Tymon with the admin guard. Any help on this?
Or does anyone know how I can authenticate two different user models using JWT and session on socket.io?
The stack I am using is - reactjs for some front end stuff, Laravel, redis as my cache, JWT tymon, file session and react native with expo for mobile development.
I do have Laravel echo server, but I dont think ill use it much as I am not firing a lot of events. Thank you
Please or to participate in this conversation.