-
Notifications
You must be signed in to change notification settings - Fork 24
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
How to provide the token over WebSocket? #478
Comments
Strike this comment - it does work with the |
After going through the very painful discussion in whatwg/websockets#16, I realize that's not a viable option in all environments though 😢 |
One alternative that might work, depending on your scenario, is to let the websocket connection rely on cookie authentication. If you first go through a browser sign-in for the same tunnel, then after that the websocket requests to the same tunnel domain will include the cookie for authentication.
Passing the token via a query parameter is generally not a good approach because URLs including query parameters are likely to be logged (by proxy servers as well as the host server). We have considered adding a capability to pass an authentication token via the websocket subprotocol, which is a common workaround mentioned in the issue you linked. The tunnel service supports that today for client connections using the tunnel SDK, but not for regular websocket client connections to forwarded ports; that would be a minor feature request. |
Unfortunately, that's not an option. I'm building a VSCode extension that acts as a DevTools host so that other programs can connect to - so you'd have for example a node process or a React Native appplication trying to use that tunnel - no browser there. (Other users might, of course, use a browser, so we cannot tell everyone to use the
So, essentially the first message would have to be some kind of That would work! I would be incredibly grateful if you could get that in! |
When making a HTTP connection, according to the documentation, I can send the token in a header like
X-Tunnel-Authorization: tunnel <TOKEN>
.Now, the normal WebSocket class has no way of sending any headers.
So, how can I provide this token on a WebSocket connection?
If this is not possible yet, may I request this as a feature?
Maybe something like
wss://my-id-7095.euw.devtunnels.ms/?tunnel-token=token
?The text was updated successfully, but these errors were encountered: