How to use basic authentication inside the function node?

I want to display some images from an URL (which has basic authentication) on node red dashboard. But every time I have to refresh the URL link and manually insert user name and password to authenticate in google chrome.

So how to use authentications inside a function node before sending it to the dashboard to display.

For displaying content with basic auth there’s 2 options basically, depending on whether you care if the user on the dashboard side is allowed to see the username/password of it. If you don’t care, just embed the images in the page but use the full address with basic auth in it, such as where foo is the username and bar is the password.

If you do care, set it up instead with with an http request node that does the auth part, and have it request those images. Then convert the buffer to a base64 string and display them through a data URL, or create a blob to display them that way.

1 Like

@afelix thanks for the reply. If I understood what you said, I did it like this. But still it should manually authenticate the URL webpage to show it in the dashboard. After that refreshing dashboard shows it.

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