From a416cbcfff5da5ba4c46c898883b4ac94ba7214a Mon Sep 17 00:00:00 2001 From: Facundo Rodriguez Date: Wed, 22 Apr 2026 12:46:29 -0300 Subject: [PATCH] fix(cli): avoid second OIDC roundtrip after auth login completion --- src/config/constants.ts | 2 +- test/commands/auth/login.test.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/config/constants.ts b/src/config/constants.ts index 5204d9ee..46e25f65 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -34,7 +34,7 @@ export const config = { graphqlHost: process.env.GRAPHQL_HOST || 'https://gateway.prod.apps.herodevs.io', graphqlPath: process.env.GRAPHQL_PATH || '/graphql', analyticsUrl: process.env.ANALYTICS_URL || 'https://apps.herodevs.com/api/eol/track', - eolLogInUrl: process.env.EOL_LOG_IN_URL || 'https://apps.herodevs.com/eol/api/auth/cli-log-in', + eolLogInUrl: process.env.EOL_LOG_IN_URL || 'https://apps.herodevs.com/eol/cli-logged-in', concurrentPageRequests, pageSize, ciTokenFromEnv: process.env.HD_CI_CREDENTIAL?.trim() || undefined, diff --git a/test/commands/auth/login.test.ts b/test/commands/auth/login.test.ts index 001440ca..e597b57e 100644 --- a/test/commands/auth/login.test.ts +++ b/test/commands/auth/login.test.ts @@ -189,9 +189,13 @@ describe('AuthLogin', () => { const server = getLatestServer(); await flushAsync(); - sendCallbackThroughStub({ code: 'test-code', state }); + const response = sendCallbackThroughStub({ code: 'test-code', state }); await expect(pendingCode).resolves.toBe(tokenResponse); + expect(response.writeHead).toHaveBeenCalledWith(302, { + Location: 'https://apps.herodevs.com/eol/cli-logged-in', + }); + expect(response.end).toHaveBeenCalledWith(); expect(questionMock).toHaveBeenCalledWith(expect.stringContaining(authUrl), expect.any(Function)); expect(closeMock).toHaveBeenCalledTimes(1); expect(openMock).toHaveBeenCalledWith(authUrl);