# Websocket with a dynamic Autharization header

**URL:** <https://discourse.nodered.org/t/websocket-with-a-dynamic-autharization-header/97097>\
**Category:** Feature Requests\
**Created:** [16 May 2025 12:49 UTC](https://discourse.nodered.org/t/websocket-with-a-dynamic-autharization-header/97097 "2025-05-16T12:49:21Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [16 May 2025 13:00 UTC](https://discourse.nodered.org/t/websocket-with-a-dynamic-autharization-header/97097/7 "2025-05-16T13:00:57Z")

</div>

BTW, just seen my reply here:

> [@Setting Websocket Headers dynamically](https://discourse.nodered.org/t/setting-websocket-headers-dynamically/88162/4):
>
> So I think you will need to do something like watching for the connection error, using a catch node, using that to trigger a flow to regen the token which you capture to a flow context variable. Hmm, but then you would have to restart the websocket and not sure how to do that. Actual environment variables are only read when Node-RED starts. However, Node-RED has extended the idea of env variables and allows you to set them in its tabs, groups and sub-flows. I've not tried this but perhaps hav…

Might give you a work-around.

---

_[View the full topic](https://discourse.nodered.org/t/websocket-with-a-dynamic-autharization-header/97097)._
