rp_st
04/09/2023, 5:16 AMrp_st
04/09/2023, 5:17 AMverifySession
as usual. During each event fire, you can authenticate the user in two ways:
1. Enable JWTs in the session recipe, and then access JWT on the frontend using await Session.getAccessTokenPayloadSecurely().jwt
, which you can send for each socket event and verify that on the backend.
2. Send the session's sessionHandle to the frontend and send that on each socket event. You can then query the SuperTokens core to get info (like the userID) from the session handle.
Method 1 is much faster since it's stateless verification, but method 2 is more secure since revoking a session will terminate the socket connection auth immediately.rp_st
04/09/2023, 5:17 AMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by