Websockets Auth #315
|
Was wondering if the auth decorator works for websocket handlers so like: |
Answered by
miguelgrinberg
Sep 18, 2025
Replies: 1 comment
|
Yes, that should work. I would put the auth decorator above the websocket one, though, so that the credentials are checked before the websocket handshake. Also keep in mind that on the browser the WebSocket API does not include the option to send custom headers, so not counting hacks that attempt to overcome this big limitation your only option is to use basic auth. |
0 replies
Answer selected by
agieocean
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, that should work. I would put the auth decorator above the websocket one, though, so that the credentials are checked before the websocket handshake. Also keep in mind that on the browser the WebSocket API does not include the option to send custom headers, so not counting hacks that attempt to overcome this big limitation your only option is to use basic auth.