I know that WebSocket api not defined headers.
- As per this we can set the basic auth with the URL.
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 ?
- Next alternative is Sec-WebSocket-Protocol header on client. I have tried with that also. But Node-RED unable to view, what ever I have set.
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" }