From ca47b0d79c21cad8dcccb16f9e974bd98de72a40 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sat, 31 Jan 2026 05:26:18 +0100 Subject: [PATCH] OAuth: normalize profile email --- src/commands/auth-choice.apply.oauth.ts | 6 ++---- src/commands/onboard-auth.credentials.ts | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/commands/auth-choice.apply.oauth.ts b/src/commands/auth-choice.apply.oauth.ts index fe0395790..4d67b94fe 100644 --- a/src/commands/auth-choice.apply.oauth.ts +++ b/src/commands/auth-choice.apply.oauth.ts @@ -68,10 +68,8 @@ export async function applyAuthChoiceOAuth( }); spin.stop("Chutes OAuth complete"); - const email = - (typeof creds.email === "string" ? creds.email.trim() : String(creds.email ?? "").trim()) || - "default"; - const profileId = `chutes:${email}`; + const email = typeof creds.email === "string" ? creds.email.trim() : ""; + const profileId = `chutes:${email || "default"}`; await writeOAuthCredentials("chutes", creds, params.agentDir); nextConfig = applyAuthProfileConfig(nextConfig, { diff --git a/src/commands/onboard-auth.credentials.ts b/src/commands/onboard-auth.credentials.ts index fbf6dbfb9..adc96d086 100644 --- a/src/commands/onboard-auth.credentials.ts +++ b/src/commands/onboard-auth.credentials.ts @@ -10,8 +10,9 @@ export async function writeOAuthCredentials( agentDir?: string, ): Promise { // Write to resolved agent dir so gateway finds credentials on startup. + const email = typeof creds.email === "string" ? creds.email.trim() : ""; upsertAuthProfile({ - profileId: `${provider}:${creds.email ?? "default"}`, + profileId: `${provider}:${email || "default"}`, credential: { type: "oauth", provider,