From ae77d34d903c3aa04f2a3e1cffdeb463e07333b8 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 15 Jul 2025 17:56:58 -0700 Subject: [PATCH] don't overwrite organization --- src/auth/workos.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/auth/workos.ts b/src/auth/workos.ts index b87e2e039..9d2931a43 100644 --- a/src/auth/workos.ts +++ b/src/auth/workos.ts @@ -137,6 +137,9 @@ function getAuthUrlForTokenPage(useOnboarding: boolean = false): string { */ async function refreshToken(refreshToken: string): Promise { try { + // Load existing config to preserve organizationId and other fields + const existingConfig = loadAuthConfig(); + const response = await axios.post( new URL("auth/refresh", env.apiBase).toString(), { @@ -150,6 +153,7 @@ async function refreshToken(refreshToken: string): Promise { const tokenExpiresAt = Date.now() + 60 * 60 * 1000; const authConfig: AuthConfig = { + ...existingConfig, // Preserve existing fields like organizationId userId: user.id, userEmail: user.email, accessToken, @@ -415,4 +419,4 @@ export function logout(): void { } else { console.info(chalk.yellow("No active session found")); } -} +} \ No newline at end of file