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

Send Headers on Connection #73

Open
rafaeliga opened this issue Dec 11, 2022 · 2 comments
Open

Send Headers on Connection #73

rafaeliga opened this issue Dec 11, 2022 · 2 comments

Comments

@rafaeliga
Copy link

Hello there,

When connecting my flutter app to rails, Im sending headers to authorize:

cable = ActionCable.Connect(constants.socketHost, headers: {
        "Authorization": constants.socketToken,
      }, onConnected: () {

Is there a way to do the same with actioncable-vue?

Thanks,

@rafaeliga
Copy link
Author

rafaeliga commented Dec 19, 2022

Any ideas?

Makes sense if I create this issue on rails/actioncable?

@jakob-lilliemarck
Copy link

jakob-lilliemarck commented Apr 9, 2024

I've run into the same issue. Passing authentication tokens in the url as the docs propose is widely insecure and bad practice. Apparently passing headers on the initial http upgrade request is unsupported in browsers:
https://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api

I guess the next best option is to send the token over the websocket channel after connection, and then start streaming the data that requires auth.

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