I know that WebSocket api not defined headers.
ws = new WebSocket("ws://username:password@example.com/service")
In NodeRED(WebSocket IN node) need to authenticate users that connect only with provided username and password. Please let me know handle this in NodeRED ?
var token = "eyJhbGci"; var options = { headers: { "Authorization" : token } }; var ws = new WebSocket("wss://example.com/path", options);
Please let me know how to view these client inputs in NodeRED and do proper client authentication ? I only see the following.
{ "payload": "Hi1", "_session": { "type": "websocket", "id": "fddc366c.0223c8" }, "_msgid": "47061971.b8f9e8" }
At this time I don't think it's possible.
Node-RED doesn't have access to the HTTP Upgrade request that converts the HTTP connection to a WS connection which is where any authentication would have to happen.
It is something that should probably be looked at in more detail to see if there is anything that could be done.