From 109909b1cde03674705a40104ba40df3ef779d23 Mon Sep 17 00:00:00 2001 From: Deepak Kasu Date: Thu, 8 Jan 2026 13:06:55 -0700 Subject: [PATCH 1/5] APIGOV-31705 Axway CLI login redirect --- .../src/authenticators/authenticator.js | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/amplify-sdk/src/authenticators/authenticator.js b/packages/amplify-sdk/src/authenticators/authenticator.js index 0f4830b4..0ba31a5e 100644 --- a/packages/amplify-sdk/src/authenticators/authenticator.js +++ b/packages/amplify-sdk/src/authenticators/authenticator.js @@ -516,11 +516,14 @@ export default class Authenticator { const account = await this.getToken(code, codeCallback.url); let redirect = orgSelectedCallback.url; - // if we just authenticated using a IdP user (e.g. not 360) - if (account.auth.idp !== '360') { - redirect = createURL(`${this.platformUrl}/#/auth/org.select`, { - redirect: orgSelectedCallback.url - }); + const orgSelect = await this.isAccountPartOfMultipleOrgs(account); + if (orgSelect) { + // if we just authenticated using a IdP user (e.g. not 360) + if (account.auth.idp !== '360' && orgSelect) { + redirect = createURL(`${this.platformUrl}/#/auth/org.select`, { + redirect: orgSelectedCallback.url + }); + } } log(`Waiting for platform org select to finish and redirect to ${highlight(redirect)}`); @@ -579,6 +582,30 @@ export default class Authenticator { return new Promise(resolve => setTimeout(resolve, 3000)); } + async isAccountPartOfMultipleOrgs(account) { + // Fetch auth session to determine if the account have multiple orgs + try { + const accessToken = account.auth.tokens.access_token; + log('Fetching auth session from platform'); + const response = await this.got(`${this.platformUrl}/api/v1/auth/findSession`, { + headers: { + Accept: 'application/json', + Authorization: `Bearer ${accessToken}` + }, + responseType: 'json', + retry: 0 + }); + const { orgs } = response.body?.['result']; + if (orgs && orgs.length > 1) { + return true; + } + } catch (err) { + warn(`Failed to find session: ${err.message}`); + } + + return false; + } + /* istanbul ignore next */ /** * This property is meant to be overridden by authenticator implementations. From 043310d1565730daf8cd124cfd6846ac104c9408 Mon Sep 17 00:00:00 2001 From: Deepak Kasu Date: Thu, 8 Jan 2026 15:10:29 -0700 Subject: [PATCH 2/5] APIGOV-31705 CR Feedback --- packages/amplify-sdk/src/amplify-sdk.js | 2 +- .../src/authenticators/authenticator.js | 21 +++++++------------ packages/axway-cli-auth/src/auth/login.js | 2 +- packages/axway-cli-oum/src/org/idp.js | 2 +- .../axway-cli-oum/src/user/credentials.js | 2 +- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/amplify-sdk/src/amplify-sdk.js b/packages/amplify-sdk/src/amplify-sdk.js index 7551c654..d8478bbb 100644 --- a/packages/amplify-sdk/src/amplify-sdk.js +++ b/packages/amplify-sdk/src/amplify-sdk.js @@ -469,7 +469,7 @@ export default class AmplifySDK { }); try { - const url = createURL(`${this.platformUrl}/#/auth/org.select`, { + const url = createURL(`${this.platformUrl}/auth/org.select`, { org_hint: org?.id, redirect }); diff --git a/packages/amplify-sdk/src/authenticators/authenticator.js b/packages/amplify-sdk/src/authenticators/authenticator.js index 0ba31a5e..fc1a23cd 100644 --- a/packages/amplify-sdk/src/authenticators/authenticator.js +++ b/packages/amplify-sdk/src/authenticators/authenticator.js @@ -516,14 +516,11 @@ export default class Authenticator { const account = await this.getToken(code, codeCallback.url); let redirect = orgSelectedCallback.url; - const orgSelect = await this.isAccountPartOfMultipleOrgs(account); - if (orgSelect) { - // if we just authenticated using a IdP user (e.g. not 360) - if (account.auth.idp !== '360' && orgSelect) { - redirect = createURL(`${this.platformUrl}/#/auth/org.select`, { - redirect: orgSelectedCallback.url - }); - } + // if we just authenticated using a IdP user (e.g. not 360) + if (account.auth.idp !== '360' && await this.isAccountPartOfMultipleOrgs(account)) { + redirect = createURL(`${this.platformUrl}/auth/org.select`, { + redirect: orgSelectedCallback.url + }); } log(`Waiting for platform org select to finish and redirect to ${highlight(redirect)}`); @@ -595,15 +592,11 @@ export default class Authenticator { responseType: 'json', retry: 0 }); - const { orgs } = response.body?.['result']; - if (orgs && orgs.length > 1) { - return true; - } + return response.body?.result?.orgs?.length > 1; } catch (err) { warn(`Failed to find session: ${err.message}`); + return false; } - - return false; } /* istanbul ignore next */ diff --git a/packages/axway-cli-auth/src/auth/login.js b/packages/axway-cli-auth/src/auth/login.js index 01403eda..54573a93 100644 --- a/packages/axway-cli-auth/src/auth/login.js +++ b/packages/axway-cli-auth/src/auth/login.js @@ -51,7 +51,7 @@ team to use for "axway" commands.`; or ${style.highlight('axway auth login --client-id --client-secret --username ')} - To set your Platform Tooling password, visit https://platform.axway.com/#/user/credentials`; + To set your Platform Tooling password, visit https://platform.axway.com/user/credentials`; } }, options: [ diff --git a/packages/axway-cli-oum/src/org/idp.js b/packages/axway-cli-oum/src/org/idp.js index 1eed6b14..51619d4a 100644 --- a/packages/axway-cli-oum/src/org/idp.js +++ b/packages/axway-cli-oum/src/org/idp.js @@ -30,7 +30,7 @@ export default { throw new Error('Managing identity provider settings requires a web browser and is unsupported in headless environments'); } - const url = `${sdk.platformUrl}#/org/${org.id}/settings/idp`; + const url = `${sdk.platformUrl}/org/${org.id}/settings/idp`; console.log(`Opening web browser to ${highlight(url)}`); await open(url); } diff --git a/packages/axway-cli-oum/src/user/credentials.js b/packages/axway-cli-oum/src/user/credentials.js index 89a2f2e5..7cc801da 100644 --- a/packages/axway-cli-oum/src/user/credentials.js +++ b/packages/axway-cli-oum/src/user/credentials.js @@ -13,7 +13,7 @@ export default { throw new Error('Changing your login credentials requires a web browser and is unsupported in headless environments'); } if (sdk !== null) { - const url = `${sdk.platformUrl}#/user/credentials`; + const url = `${sdk.platformUrl}/user/credentials`; console.log(`Opening web browser to ${highlight(url)}`); await open(url); } From 596034cbc48b46df11fdfdd20b96c302be2e1075 Mon Sep 17 00:00:00 2001 From: Deepak Kasu Date: Thu, 22 Jan 2026 10:34:43 -0700 Subject: [PATCH 3/5] Fix tests for the URL changes --- test/auth/login/help.mustache | 2 +- test/helpers/platform-routes.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/auth/login/help.mustache b/test/auth/login/help.mustache index f3cda10f..541e0f92 100644 --- a/test/auth/login/help.mustache +++ b/test/auth/login/help.mustache @@ -53,4 +53,4 @@ EXAMPLES: or {{#cyan}}axway auth login --client-id --client-secret --username {{/cyan}} - To set your Platform Tooling password, visit https://platform.axway.com/#/user/credentials + To set your Platform Tooling password, visit https://platform.axway.com/user/credentials diff --git a/test/helpers/platform-routes.js b/test/helpers/platform-routes.js index a63a86aa..704971ad 100644 --- a/test/helpers/platform-routes.js +++ b/test/helpers/platform-routes.js @@ -820,7 +820,7 @@ export function createPlatformRoutes(server, opts = {}) { `; }) - server.router.get([ '/', '/success' ], ctx => { + server.router.get([ '/', '/success', '/auth/org.select' ], ctx => { ctx.body = ` Test successful! @@ -830,9 +830,9 @@ export function createPlatformRoutes(server, opts = {}) {

You can close this browser window

From 4532d7af6917c8223ebb0a8ad9826d566401a080 Mon Sep 17 00:00:00 2001 From: Deepak Kasu Date: Thu, 22 Jan 2026 11:34:40 -0700 Subject: [PATCH 4/5] fix tests --- test/user/credentials/open-browser.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/user/credentials/open-browser.mustache b/test/user/credentials/open-browser.mustache index 1b15c058..b0088491 100644 --- a/test/user/credentials/open-browser.mustache +++ b/test/user/credentials/open-browser.mustache @@ -1,4 +1,4 @@ {{#cyan}}AXWAY CLI{{/cyan}}, version {{version}} Copyright (c) 2018-{{year}}, Axway, Inc. All Rights Reserved.{{{nodeDeprecationWarning}}} -Opening web browser to {{#cyan}}https://platform.axway.com#/user/credentials{{/cyan}} \ No newline at end of file +Opening web browser to {{#cyan}}https://platform.axway.com/user/credentials{{/cyan}} \ No newline at end of file From a96f276688bf90a94df31422fe65eab1b74afe05 Mon Sep 17 00:00:00 2001 From: Deepak Kasu Date: Thu, 22 Jan 2026 12:56:20 -0700 Subject: [PATCH 5/5] Publish - @axway/amplify-cli-utils@6.0.6 - @axway/amplify-config@5.0.6 - @axway/amplify-request@4.0.6 - @axway/amplify-sdk@4.0.6 - @axway/amplify-utils@2.0.6 - axway@4.0.5 - @axway/axway-cli-auth@4.0.6 - @axway/axway-cli-oum@3.0.6 - @axway/axway-cli-pm@5.0.6 --- packages/amplify-cli-utils/package.json | 8 ++++---- packages/amplify-config/package.json | 4 ++-- packages/amplify-request/package.json | 4 ++-- packages/amplify-sdk/package.json | 6 +++--- packages/amplify-utils/package.json | 2 +- packages/axway-cli-auth/package.json | 6 +++--- packages/axway-cli-oum/package.json | 4 ++-- packages/axway-cli-pm/package.json | 6 +++--- packages/axway-cli/package.json | 12 ++++++------ 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/amplify-cli-utils/package.json b/packages/amplify-cli-utils/package.json index 9be4908f..9c8d56a4 100644 --- a/packages/amplify-cli-utils/package.json +++ b/packages/amplify-cli-utils/package.json @@ -1,6 +1,6 @@ { "name": "@axway/amplify-cli-utils", - "version": "6.0.5", + "version": "6.0.6", "publishConfig": { "access": "public" }, @@ -24,9 +24,9 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-config": "^5.0.5", - "@axway/amplify-request": "^4.0.5", - "@axway/amplify-sdk": "^4.0.5", + "@axway/amplify-config": "^5.0.6", + "@axway/amplify-request": "^4.0.6", + "@axway/amplify-sdk": "^4.0.6", "boxen": "^8.0.1", "check-kit": "^4.0.0", "cli-kit": "^2.1.1", diff --git a/packages/amplify-config/package.json b/packages/amplify-config/package.json index 9885d00c..fc7b37f8 100644 --- a/packages/amplify-config/package.json +++ b/packages/amplify-config/package.json @@ -1,6 +1,6 @@ { "name": "@axway/amplify-config", - "version": "5.0.5", + "version": "5.0.6", "publishConfig": { "access": "public" }, @@ -24,7 +24,7 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-utils": "^2.0.5", + "@axway/amplify-utils": "^2.0.6", "config-kit": "^2.1.0", "fs-extra": "^10.1.0", "source-map-support": "^0.5.21" diff --git a/packages/amplify-request/package.json b/packages/amplify-request/package.json index be266f25..3c301569 100644 --- a/packages/amplify-request/package.json +++ b/packages/amplify-request/package.json @@ -1,6 +1,6 @@ { "name": "@axway/amplify-request", - "version": "4.0.5", + "version": "4.0.6", "publishConfig": { "access": "public" }, @@ -28,7 +28,7 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-utils": "^2.0.5", + "@axway/amplify-utils": "^2.0.6", "got": "^11.8.5", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.1", diff --git a/packages/amplify-sdk/package.json b/packages/amplify-sdk/package.json index 1cc19dc3..2312ed28 100644 --- a/packages/amplify-sdk/package.json +++ b/packages/amplify-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@axway/amplify-sdk", - "version": "4.0.5", + "version": "4.0.6", "publishConfig": { "access": "public" }, @@ -23,8 +23,8 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-request": "^4.0.5", - "@axway/amplify-utils": "^2.0.5", + "@axway/amplify-request": "^4.0.6", + "@axway/amplify-utils": "^2.0.6", "ci-info": "^3.3.1", "ejs": "^3.1.10", "fs-extra": "^10.1.0", diff --git a/packages/amplify-utils/package.json b/packages/amplify-utils/package.json index 241af4a9..830575c5 100644 --- a/packages/amplify-utils/package.json +++ b/packages/amplify-utils/package.json @@ -1,6 +1,6 @@ { "name": "@axway/amplify-utils", - "version": "2.0.5", + "version": "2.0.6", "publishConfig": { "access": "public" }, diff --git a/packages/axway-cli-auth/package.json b/packages/axway-cli-auth/package.json index 586a1c5a..78ecec70 100644 --- a/packages/axway-cli-auth/package.json +++ b/packages/axway-cli-auth/package.json @@ -1,6 +1,6 @@ { "name": "@axway/axway-cli-auth", - "version": "4.0.5", + "version": "4.0.6", "publishConfig": { "access": "public" }, @@ -23,8 +23,8 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-cli-utils": "^6.0.5", - "@axway/amplify-utils": "^2.0.5", + "@axway/amplify-cli-utils": "^6.0.6", + "@axway/amplify-utils": "^2.0.6", "cli-kit": "github:kasuvy/cli-kit#APIGOV-29723", "enquirer": "^2.3.6", "pretty-ms": "^7.0.1", diff --git a/packages/axway-cli-oum/package.json b/packages/axway-cli-oum/package.json index b0895e29..bd4a8a45 100644 --- a/packages/axway-cli-oum/package.json +++ b/packages/axway-cli-oum/package.json @@ -1,6 +1,6 @@ { "name": "@axway/axway-cli-oum", - "version": "3.0.5", + "version": "3.0.6", "publishConfig": { "access": "public" }, @@ -22,7 +22,7 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-cli-utils": "^6.0.5", + "@axway/amplify-cli-utils": "^6.0.6", "cli-kit": "^2.1.1", "open": "^8.4.0", "snooplogg": "^5.1.0", diff --git a/packages/axway-cli-pm/package.json b/packages/axway-cli-pm/package.json index 3e152e7f..a3737c46 100644 --- a/packages/axway-cli-pm/package.json +++ b/packages/axway-cli-pm/package.json @@ -1,6 +1,6 @@ { "name": "@axway/axway-cli-pm", - "version": "5.0.5", + "version": "5.0.6", "publishConfig": { "access": "public" }, @@ -22,8 +22,8 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-cli-utils": "^6.0.5", - "@axway/amplify-utils": "^2.0.5", + "@axway/amplify-cli-utils": "^6.0.6", + "@axway/amplify-utils": "^2.0.6", "cli-kit": "^2.1.1", "cross-spawn": "^7.0.3", "fs-extra": "^10.1.0", diff --git a/packages/axway-cli/package.json b/packages/axway-cli/package.json index 75281360..efc847ac 100644 --- a/packages/axway-cli/package.json +++ b/packages/axway-cli/package.json @@ -1,6 +1,6 @@ { "name": "axway", - "version": "4.0.4", + "version": "4.0.5", "publishConfig": { "access": "public" }, @@ -28,11 +28,11 @@ "test": "gulp test" }, "dependencies": { - "@axway/amplify-cli-utils": "^6.0.5", - "@axway/amplify-utils": "^2.0.5", - "@axway/axway-cli-auth": "^4.0.5", - "@axway/axway-cli-oum": "^3.0.5", - "@axway/axway-cli-pm": "^5.0.5", + "@axway/amplify-cli-utils": "^6.0.6", + "@axway/amplify-utils": "^2.0.6", + "@axway/axway-cli-auth": "^4.0.6", + "@axway/axway-cli-oum": "^3.0.6", + "@axway/axway-cli-pm": "^5.0.6", "boxen": "^8.0.1", "check-kit": "^4.0.0", "cli-kit": "^2.1.1",