Authentication in websocket connections

In websockets its not possible to send an authorization header, so I’ve had to resort to sending in the authention token as a query param to the websocket URL. But, is there a directive to handle the authorization, which doesn’t rely on the header? Or another way to authenticate websocket connections?

In websockets its not possible to send an authorization header …

Are you sure about that? I had this old sample of Basic Auth and WebSocket laying around: Akka ticket #19689 · GitHub

Didn’t test it now but I think it should work fine.

1 Like

@johanandren Pretty sure: https://stackoverflow.com/questions/22383089/is-it-possible-to-use-bearer-authentication-for-websocket-upgrade-requests

It may have worked in unit tests but wouldn’t work in actual browser based websockets

Thanks for linking that back, sounds like a parameter is the way to go from that SO answer.