Login data as global variables for different devices

Hello everybody,
I want to see the values from diffrent devices in one dashboard. The only thing I have to change
is the IP-Adress, the user name and the password.

So I want to use a login form like you see in the picture and set this values as variables in the http-request node.

What I need is a little help to realize this.

Thank you in advance for your support
Ralf

You can pass in the url using msg.url but you can not dynamically set username or password

You should be able to pass in the basic authentication as part of the msg.headers - The name should the Authorization and the valuve should be
Basic plus the base64-encoded username:password. For example, the Base64 version of testuser:testpwd is dGVzdHVzZXI6dGVzdHB3ZA== so the Value for the msg.headers would be

{"Authorization": "Basic dGVzdHVzZXI6dGVzdHB3ZA=="}
1 Like

But please remember to use https throughout if you care about security.

1 Like

Hi, and thank you for your replys,
first of all, please remember that you are talking to a beginner :wink:

Let's get out the username and password first and focus on the IP address.
Maybe I did not put my question right, so I would like to explain that again.

I have three devices. The only difference between these three devices is the IP address. I have now built a dashboard and all data from device 1 will be displayed. Now I want to see all data from device 2 on the dashboard. For this, the IP address must be swapped in all http-request nodes. For that I'm looking for the right solution.

It would of course be easiest for me if I could get a little example.

Thanks for your help and patience

As already said. You can send the http request node the url in a message msg.url

You can use the change node or a function node to set the msg.url

If it is an IP address you can set msg.url dynamically, as mentioned a few times above.

On the other hand, if it’s just 3 specific devices with a set username/password that doesn’t change you could take a look at node-red-contrib-credentials for each set, followed by a subflow of the relevant nodes such as a function node to set up basic authorisation, the http request node, and handlers to deal with the output. If it’s only 3 devices such a setup is maintainable and will solve the sending out usernames/password potential security issue from the dashboard back to the runtime as they’ll only live in the runtime.

454/5000
Hi,
I think I understand what you mean, but unfortunately can not implement, because I'm too much beginner. I do not understand the syntax of this programming tool and therefore only get error messages.

Since I do not want to waste your time, I'll give it up first and maybe try again later.

Thank you for your attempts to teach me. :+1:
Have a nice day and take care.

Ralf