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

Basic Authentication #88

Closed
ccs1910 opened this issue Jan 29, 2019 · 4 comments
Closed

Basic Authentication #88

ccs1910 opened this issue Jan 29, 2019 · 4 comments

Comments

@ccs1910
Copy link

ccs1910 commented Jan 29, 2019

i am creating a simple chat application and the chat-api is using websocket to connect and stomp protocol.

but in my case the authentication is using "Basic Authentication".
do you have an idea on how to do it?

thanks,

@kum-deepak
Copy link
Member

Browsers, typically, will not allow setting headers to the underlying HTTP request for a WebSocket. So, you will not be able to use Basic Authentication. If you are using Spring for your back-end please check https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#websocket-stomp-authentication-token-based for a mechanism to use headers with CONNECT frame for authentication.

Also, please upgrade to newer version of the library for a cleaner interface. https://stomp-js.github.io/guide/ng2-stompjs/2018/11/05/migrate-ng2-stompjs-v7.html and https://stomp-js.github.io/guide/ng2-stompjs/2018/11/04/ng2-stomp-with-angular7.html

@ccs1910
Copy link
Author

ccs1910 commented Feb 8, 2019

would it be possible to add extra header?

@ccs1910
Copy link
Author

ccs1910 commented Feb 8, 2019

For example adding an extra header in here :

headers: {
login: 'guest',
passcode: 'guest'
},

i supposed this is not a fixed value, right?
should be depends on the expexted value from server side, correct?

@kum-deepak kum-deepak transferred this issue from stomp-js/ng6-stompjs-demo Mar 4, 2019
@kum-deepak
Copy link
Member

Yes, keys and their values will depend on what the server expects. These need to be strings though.

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

2 participants