Http request basic auth environment variables

I would like to set environment variables on the flow (tab) and use them in the user/password credentials field, is this possible ? Because copy/pasting the node removes the credentials (cut/paste doesn't - clever!), but it is a bit annoying with complicated credentials.

Or should i just use header properties instead ?

It is possible to set via env vars, but all the usual rules remain around the editor not showing the true value of password fields. So you will need to enter the env var names in the fields for any new nodes you create.

Copy/paste creates a new node - and as the editor doesn't have the true values of the credentials you have to re-enter them.

A Cut/paste is more like a 'move' of an existing node - it keeps the same ID. This means the existing credentials are maintained as the node id doesn't change.

Yes understood thanks.

How do you actually use the env vars in fields ? is that just a matter of using $MY_USER directly in the field ?

https://nodered.org/docs/user-guide/environment-variables

Any node property can be set with an environment variable by setting its value to a string of the form ${ENV_VAR} . When the runtime loads the flows, it will substitute the value of that environment variable before passing it to the node.

1 Like

Ah sorry looked over it thanks.

I cannot mark this as solved, but it's solved :slight_smile:

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