# Is there anyway to deploy flows to multiple devices and not have the credentials for applicable nodes not lose configuration?

**URL:** <https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065>\
**Category:** General\
**Created:** [14 July 2020 14:17 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065 "2020-07-14T14:17:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [14 July 2020 14:17 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/1 "2020-07-14T14:17:44Z")

</div>

Is there anyway to deploy flows to multiple devices and not have the credentials for applicable nodes not lose configuration?

I tried deploying the flows credential file when I deployed the matching flows file. But I still get the warning that the credentials file is invalid, which is understandable, if I understand the design as such, anchored to the original system instance, if not node red instance.

If there is not a way to do such, I would point out that cached (once validated) credentials are deployed remotely all the time, in various environments and for various solutions. If the given id does not exist on the remote machine, or the password is out sync, failure results, which is the correct behavior, so it would not be like you could somehow establish or create access from accepting deployment of cached credentials.

There really should be some option for this IMHO. How about the warning dialog as a passive warning, but the credentials still are honored, if some node red configuration setting is set to allow same? Maybe an override option in the settings.js file?

---

<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:** [14 July 2020 14:38 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/2 "2020-07-14T14:38:49Z")

</div>

When you say you tried deploying the credential file, do you mean you did a POST of the file to the `/flows` endpoint?

The correct way to deploy flows & credentials is to send a POST to `/flows` in the format:

```javascript
{
   "flows": [... contents of your flows file ...],
   "credentials: { ... contents of your credentials file
} 

```

And must set the `Node-RED-API-Version` HTTP header to `v2`.

If your credentials file is encrypted, then you must make sure all of the target devices have the same value of `credentialSecret` set in their settings file - otherwise they will not be able to decrypt the credentials.

The ability to pass in the `credentials` object to this API was added a while ago, but I see the [API docs](https://nodered.org/docs/api/admin/methods/post/flows/) were not updated. I'll raise an issue to remind us to fix that.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [14 July 2020 15:30 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/3 "2020-07-14T15:30:43Z")

</div>

No, I did not do an explicit POST, tried to take the short path, just copied the file... expecting it could not be that easy. 🙂

---

<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:** [14 July 2020 15:32 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/4 "2020-07-14T15:32:13Z")

</div>

You can also just copy the two files over to the devices and restart Node-RED if that's easier for you. The comment on ensuring each device has the same `credentialSecret` still stands.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [14 July 2020 15:34 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/5 "2020-07-14T15:34:37Z")

</div>

That was the next idea! Cool. Right now I just have script file that does file copies out to each device, so this should be easy to do. I have also implemented a POST sequence in a flow, got that working as well. Long term want to use the POST method, using a 'admin' tab in the ui from one node red instance.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [15 July 2020 18:36 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/6 "2020-07-15T18:36:47Z")

</div>

When the API docs are updated? Suggestion, include a complete example of how to do the POST, including how to qualify the API version setting. Not a POST guru, so I have no idea, at the moment how to qualify the API version. Can I append it to the flows verb?

```auto
:1880/flows/v2

```

This is how you would do it Foreman.

---

<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:** [13 September 2020 18:36 UTC](https://discourse.nodered.org/t/is-there-anyway-to-deploy-flows-to-multiple-devices-and-not-have-the-credentials-for-applicable-nodes-not-lose-configuration/30065/7 "2020-09-13T18:36:52Z")

</div>

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