robtaussig/react-use-websocket

How do I send Authorization headers (Bearer Token) with the message?

Closed this issue · 2 comments

I need to send Bearer Authorization with the message (access token), but I can't find it in the documentation.

I have checked out #94 as well as https://ably.com/blog/websocket-authentication, but it does not seem to work

Try generating a ticket for the client (essentially the same thing as a JWT but used for the websocket instead). You can either pass the ticket via the URL of the websocket or it can be sent as the first message to authenticate the client.

@Kyrixty our team opted to send the token as the initial message. Seems like web sockets in general do not support authorization headers