Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing the access token in Sec-WebSocket-Protocol header to authorize WebSocket connections #4490

Closed
ghys opened this issue Dec 9, 2024 · 0 comments · Fixed by #4515
Labels
enhancement An enhancement or new feature of the Core

Comments

@ghys
Copy link
Member

ghys commented Dec 9, 2024

Currently when establishing a WebSocket connection the access token can only be practically passed via the accessToken URI query parameter.
This is generally frowned upon since they might end up in web server/proxies logs. It's not that critical for access tokens because they're short-lived (1h) but it's still not ideal.
Browsers cannot add Authorization headers to WebSocket requests but can specify something to add to the Sec-WebSocket-Protocol header; and some (like Kubernetes) misuse this to send the token.

It might be nice to have that option as well.

More info:
https://stackoverflow.com/a/77060459 (option 5, note that option 6 suggests... switching to SSE)
https://ably.com/blog/websocket-authentication

Your Environment

openHAB 4.3.0.M5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant