How to copy credentials in node-red flow?

I have a mqtt node and in the mqtt node, I have all the credentials e.g. password, username etc and I am taking the password and username from the environment variables like this $(Password).

Now when i export the flow and paste it to another node-red, my username and password field is always empty hence flow doesnt contain the credentials.
So my question is,how can i also copy the credentials with the flow?

The credentials are stored in a separate file eg. flows_cred.json
As a security measure you won't be copying/pasting credentials and this makes them more easily exportable without running the risk of exposing credentials.

So to answer your question, you cannot export the flow with credentials.

1 Like

Thanks @bakman2, is there any work around for that? as i am getting my username and password from the environment variables and its not actually text fields

is there any way to copy the credentials in the flow before running the node-red? or during the node-red ?

As @bakman2 almost said... as the credentials are in a separate file - you will need to copy that over manually to the new system. maybe scp if you are using linux/mac. usb stick, etc...

1 Like

That means with the flow i should also copy flow_cred.json file? i tried that but it doesnt work.. maybe some other problem.. i will take a look at it.. thanks

I think (though not certain) that you also you must use a credentials secret in settings.js as this is used to decrypt the credentials and copy that across too.

1 Like

my credentialSecret is commented.. is there any default secret too?

Look in ~/.node-red/.config.json for the _credentialSecret value. That is the auto-generated value that is used if you don't provide your own in your settings file. Copy its value over to your settings file under credentialSecrets key.

3 Likes

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