fix(cliproxy): use management oauth-callback in paste flow

This commit is contained in:
Brian Le
2026-03-03 17:59:10 -05:00
parent 6fcd924b1c
commit fa027022a8
3 changed files with 14 additions and 3 deletions
+4
View File
@@ -258,6 +258,10 @@ export function getManagementAuthUrlPath(provider: CLIProxyProvider): string {
return `/v0/management/${authUrlProvider}-auth-url?is_webui=true`;
}
export function getManagementOAuthCallbackPath(): string {
return '/v0/management/oauth-callback';
}
/**
* Get OAuth config for provider
*/
+2 -2
View File
@@ -38,6 +38,7 @@ import {
ProviderOAuthConfig,
CLIPROXY_CALLBACK_PROVIDER_MAP,
getManagementAuthUrlPath,
getManagementOAuthCallbackPath,
normalizeKiroAuthMethod,
} from './auth-types';
import { isHeadlessEnvironment, killProcessOnPort, showStep } from './environment-detector';
@@ -370,8 +371,7 @@ async function handlePasteCallbackMode(
const callbackProvider = CLIPROXY_CALLBACK_PROVIDER_MAP[provider] || provider;
// Note: /oauth-callback is a CLIProxyAPI endpoint (not /v0/management prefix)
const callbackResponse = await fetch(buildProxyUrl(target, '/oauth-callback'), {
const callbackResponse = await fetch(buildProxyUrl(target, getManagementOAuthCallbackPath()), {
method: 'POST',
headers: buildManagementHeaders(target, { 'Content-Type': 'application/json' }),
body: JSON.stringify({
@@ -1,5 +1,8 @@
import { describe, expect, it } from 'bun:test';
import { getManagementAuthUrlPath } from '../../../src/cliproxy/auth/auth-types';
import {
getManagementAuthUrlPath,
getManagementOAuthCallbackPath,
} from '../../../src/cliproxy/auth/auth-types';
describe('auth-types management auth-url path', () => {
it('maps providers to CLIProxyAPI management auth-url routes', () => {
@@ -16,4 +19,8 @@ describe('auth-types management auth-url path', () => {
expect(getManagementAuthUrlPath('ghcp')).toBe('/v0/management/github-auth-url?is_webui=true');
expect(getManagementAuthUrlPath('kiro')).toBe('/v0/management/kiro-auth-url?is_webui=true');
});
it('uses CLIProxyAPI management oauth-callback route', () => {
expect(getManagementOAuthCallbackPath()).toBe('/v0/management/oauth-callback');
});
});