I'm setting up a Node.js server to communicate with WebSockets to my web app. I was planning on using JSON Web Tokens to limit access to only users who have already authenticated with our webapp. While researching, I am having trouble finding a WebSocket package for Node.js that supports client-side setting of the Authorization
header and using that on the initial connection call?
I regularly see recommendations to pass the token via query param, which could be less secure than passing the token via the Authorization
header. Am I missing something? Are there any good, well-maintained WebSocket libraries that allow setting the Authorization
header client-side so that I can prevent unwanted connections to the server?