From 101378c62555a08740b030cbf552febff7d019eb Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 6 Mar 2021 20:09:03 +0000 Subject: [PATCH] Properly handle credentials passed to /flows api --- .../node_modules/@node-red/runtime/lib/flows/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/lib/flows/index.js b/packages/node_modules/@node-red/runtime/lib/flows/index.js index 8d6fe1873..55d5b2dc5 100644 --- a/packages/node_modules/@node-red/runtime/lib/flows/index.js +++ b/packages/node_modules/@node-red/runtime/lib/flows/index.js @@ -160,8 +160,15 @@ function setFlows(_config,_credentials,type,muteLog,forceStart,user) { var credsDirty; if (_credentials) { + credentials.clean(config); // A full set of credentials have been provided. Use those instead - configSavePromise = credentials.load(_credentials); + let credentialSavePromises = []; + for (let id in _credentials) { + if (_credentials.hasOwnProperty(id)) { + credentialSavePromises.push(credentials.add(id,_credentials[id])); + } + } + configSavePromise = Promise.all(credentialSavePromises); credsDirty = true; } else { // Allow the credential store to remove anything no longer needed