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

Handshake failure with basic Authorization #244

Open
Na2l opened this issue Jan 12, 2023 · 0 comments
Open

Handshake failure with basic Authorization #244

Na2l opened this issue Jan 12, 2023 · 0 comments

Comments

@Na2l
Copy link

Na2l commented Jan 12, 2023

adding header basic auth header to the websocket object causes server to close the connection imidietly with this warning messageL

Session 30 closed because of CloseReason: code [1002], reason [A fragmented control frame was received but control frames may not be fragmented]

String identity = userID + ":" + passwd;
String encoded= Base64.encodeToString(identity.getBytes(), Base64.DEFAULT);
webSocket.addHeader("Authorization", "Basic " + encoded);

The workaround is to instead of adding the basic auth header to add the user:pass to the request uri, i.e.:
uri = new URI("wss://" + user+":" + pass+ <SERVER_IP>:"443/websocket" );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant