javascript - Authentication flow with jwt and socket io -


my socket.io application requires user authenticated before he/she can send message , connected reading messages without authentication.

below code sample based on assumption client login via rest api, obtain jwt , reconnect socket server using received token:

var socket = io.connect('', {   query: 'token=' + token }); 

how construct authentication flow application?

i don't understand problem? know how handle jwt? or when make call login , obtaining token? in application user logins via rest api getting token , can use example these module https://github.com/auth0/socketio-jwt


Comments