diff --git a/packages/node_modules/@node-red/editor-client/src/js/settings.js b/packages/node_modules/@node-red/editor-client/src/js/settings.js index c9a24d636..af7f091c9 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/settings.js +++ b/packages/node_modules/@node-red/editor-client/src/js/settings.js @@ -33,8 +33,8 @@ RED.settings = (function () { if (!hasLocalStorage()) { return; } - if (key === "auth-tokens") { - localStorage.setItem(key, JSON.stringify(value)); + if (key.startsWith("auth-tokens")) { + localStorage.setItem(key+this.authTokensSuffix, JSON.stringify(value)); } else { RED.utils.setMessageProperty(userSettings,key,value); saveUserSettings(); @@ -52,8 +52,8 @@ RED.settings = (function () { if (!hasLocalStorage()) { return undefined; } - if (key === "auth-tokens") { - return JSON.parse(localStorage.getItem(key)); + if (key.startsWith("auth-tokens")) { + return JSON.parse(localStorage.getItem(key+this.authTokensSuffix)); } else { var v; try { v = RED.utils.getMessageProperty(userSettings,key); } catch(err) {} @@ -71,8 +71,8 @@ RED.settings = (function () { if (!hasLocalStorage()) { return; } - if (key === "auth-tokens") { - localStorage.removeItem(key); + if (key.startsWith("auth-tokens")) { + localStorage.removeItem(key+this.authTokensSuffix); } else { delete userSettings[key]; saveUserSettings(); @@ -99,6 +99,8 @@ RED.settings = (function () { var init = function (options, done) { var accessTokenMatch = /[?&]access_token=(.*?)(?:$|&)/.exec(window.location.search); + var path=window.location.pathname.slice(0,-1); + RED.settings.authTokensSuffix=path.replaceAll('/', '-'); if (accessTokenMatch) { var accessToken = accessTokenMatch[1]; RED.settings.set("auth-tokens",{access_token: accessToken});