# How do you securely pass a token over websocket with Auth0?

**URL:** <https://community.auth0.com/t/how-do-you-securely-pass-a-token-over-websocket-with-auth0/120247>\
**Category:** Get Help\
**Tags:** identifier-first, login-experience\
**Created:** [November 5, 2023, 7:12am UTC](https://community.auth0.com/t/how-do-you-securely-pass-a-token-over-websocket-with-auth0/120247 "2023-11-05T07:12:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![storyknight](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/storyknight/32/48798_2.png) [@storyknight](https://community.auth0.com/u/storyknight)\
**Post date:** [November 5, 2023, 7:12am UTC](https://community.auth0.com/t/how-do-you-securely-pass-a-token-over-websocket-with-auth0/120247/1 "2023-11-05T07:12:57Z")

</div>

I have followed this example when it has come to securing an API: [Auth0 Go API SDK Quickstarts: Authorization](https://auth0.com/docs/quickstart/backend/golang/01-authorization)

However, there is no way to pass an Authorization header onto a websocket (as far as I understand). One alternative is to pass the full token in the query parameters, but this is not secure e.g. ws://example.com/ws?token=XXX

Hope that makes sense, and thank you for any help!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [November 6, 2023, 9:40pm UTC](https://community.auth0.com/t/how-do-you-securely-pass-a-token-over-websocket-with-auth0/120247/2 "2023-11-06T21:40:15Z")

</div>

Hey there @storyknight welcome to the community!

> [@storyknight](#):
>
> However, there is no way to pass an Authorization header onto a websocket (as far as I understand). One alternative is to pass the full token in the query parameters, but this is not secure e.g. ws://example.com/ws?token=XXX

Unfortunately I’m not sure there is an easy workaround for this - Is it an option to pass the token as a custom header when initially setting up the websocket connection?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 20, 2023, 9:41pm UTC](https://community.auth0.com/t/how-do-you-securely-pass-a-token-over-websocket-with-auth0/120247/4 "2023-11-20T21:41:04Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
