# Persist user/password info for nodes

**URL:** <https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874>\
**Category:** General\
**Created:** [15 April 2020 12:57 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874 "2020-04-15T12:57:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![louison](https://avatars.discourse-cdn.com/v4/letter/l/b19c9b/32.png) [@louison](https://discourse.nodered.org/u/louison)\
**Post date:** [15 April 2020 12:57 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/1 "2020-04-15T12:57:00Z")

</div>

Hello,

Specifics nodes need user/pwd informations like MQTT broker for example.

If I want to persist informations after nodered restart, I need to put them in flows\_cred.json. It works.  
If I only fill these informations directly in the flow, I will loose these values after nodered restart.

Is there another way to keep these informations whithout using flows\_cred.json ?

Best Regards,

Louison

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 April 2020 13:01 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/2 "2020-04-15T13:01:21Z")

</div>

> [@louison](#):
>
> If I only fill these informations directly in the flow, I will loose these values after nodered restart.

Can you explain what you mean here?

Taking the MQTT Broker node as your example, you enter the username/password details in the node, then hit deploy and the credentials get saved.

Do you mean your flow is generating credentials as part of its running and you want to be able to store them somewhere?

I'm not aware of a node that can dynamically store values like credentials in a secure manner.

---

<div class="post-metadata">

**Author:** ![louison](https://avatars.discourse-cdn.com/v4/letter/l/b19c9b/32.png) [@louison](https://discourse.nodered.org/u/louison)\
**Post date:** [15 April 2020 13:10 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/3 "2020-04-15T13:10:55Z")

</div>

Hi knolleary,

> [@knolleary](#):
>
> Can you explain what you mean here?

Your understanding is good.  
Taking the MQTT Broker node as an example, I enter the username/password details in the node, then hit deploy and the credentials get saved. I don't know where ? Probably in RAM but not in flows.json.

> [@knolleary](#):
>
> Do you mean your flow is generating credentials as part of its running and you want to be able to store them somewhere?

You're right. I want to keep my user/pwd informations after a nodered restart.  
I don't want to use flows\_cred.json to persist them. Is there another way to keep these informations ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 April 2020 13:13 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/4 "2020-04-15T13:13:44Z")

</div>

> [@louison](#):
>
> hit deploy and the credentials get saved. I don't know where ? Probably in RAM but not in flows.json

When you deploy the MQTT Broker node, its credentials are stored in the credentials file. That is where all node credentials are stored.

As I said before, I'm not aware of a node that can dynamically store values like credentials in a secure manner.

You could store them in context, but that would require persistent context to be enabled, and the credentials would be stored unencrypted.

---

<div class="post-metadata">

**Author:** ![louison](https://avatars.discourse-cdn.com/v4/letter/l/b19c9b/32.png) [@louison](https://discourse.nodered.org/u/louison)\
**Post date:** [15 April 2020 13:18 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/5 "2020-04-15T13:18:21Z")

</div>

> [@knolleary](#):
>
> When you deploy the MQTT Broker node, its credentials are stored in the credentials file. That is where all node credentials are stored.

The credentials file you mentionned is flows\_cred.json ?

I'm not sure about another way to persist the data indeed.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 April 2020 13:19 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/6 "2020-04-15T13:19:41Z")

</div>

> [@louison](#):
>
> The credentials file you mentionned is flows\_cred.json ?

Yes, that is the file that contains node credentials.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 April 2020 13:43 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/7 "2020-04-15T13:43:11Z")

</div>

If you still have the problem that mqtt node credentials are not saved over a node red restart then I suggest doing the following.  
Restart node-red by running

```auto
node-red-stop
node-red-start

```

leave the terminal open. Then enter the credentials in the MQTT node. This is what you mean presumably  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2d703a663c6a6b4f4edb7985a4b6cd8392ce3c50.png)  
Deploy it and then run

```auto
node-red-stop
node-red-start

```

again. Assuming that your credentials are not saved then copy/paste the full log here. Also run, in the .node-red directory  
`ls -l`  
and post that too.

---

<div class="post-metadata">

**Author:** ![louison](https://avatars.discourse-cdn.com/v4/letter/l/b19c9b/32.png) [@louison](https://discourse.nodered.org/u/louison)\
**Post date:** [15 April 2020 14:24 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/8 "2020-04-15T14:24:33Z")

</div>

Hi Colin,

Just to give you some precisions.

I don't really have problems to store MQTT credentials. I can store them in flows\_cred.json and after restarting nodered my credentials exist.

I just try to find another way to persist my credentials whithout using flows\_cred.json.

I will have several customers and I don't want to share some informations in flows\_cred.json. Even if this file can be crypted. And I don't want to manage a file per customer.

The idea is (but I don't know if it's possible):

I start nodered.  
I load the flow.  
I set up user and password for mqtt broker in the node.  
I deploy.  
And that's all.  
The problem: if nodered restarts, I will lost the setup.

Do you always need that I proceed with your recommandations to trace ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 April 2020 19:47 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/9 "2020-04-15T19:47:26Z")

</div>

OK, I understand what you mean now.

Do different users need different credentials for MQTT? If not then I don't see why the credentials file would be unique to a customer.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 June 2020 19:47 UTC](https://discourse.nodered.org/t/persist-user-password-info-for-nodes/24874/10 "2020-06-14T19:47:33Z")

</div>

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