mirror of https://github.com/openclaw/openclaw.git
fix(auth): align profile-id in config with writeOAuthCredentials
writeOAuthCredentials writes profile as `provider:email` when email is present, but applyAuthProfileConfig was always called with `provider:default`. This caused config to reference a non-existent profile when OAuth returned an email. Compute the same profile-id (email or 'default' fallback) in both auth-choice.apply.oauth.ts (chutes) and auth-choice.apply.openai.ts (openai-codex) so config references the actually-written profile. Fixes failing tests: - stores openai-codex OAuth with email profile id - writes Chutes OAuth credentials when selecting chutes (remote/manual)
This commit is contained in:
parent
30123a5496
commit
6a53a91ff3
|
|
@ -69,8 +69,10 @@ export async function applyAuthChoiceOAuth(
|
|||
|
||||
spin.stop("Chutes OAuth complete");
|
||||
await writeOAuthCredentials("chutes", creds, params.agentDir);
|
||||
const chutesEmail =
|
||||
typeof creds.email === "string" && creds.email.trim() ? creds.email.trim() : "default";
|
||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||
profileId: "chutes:default",
|
||||
profileId: `chutes:${chutesEmail}`,
|
||||
provider: "chutes",
|
||||
mode: "oauth",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -120,8 +120,10 @@ export async function applyAuthChoiceOpenAI(
|
|||
await writeOAuthCredentials("openai-codex", creds, params.agentDir, {
|
||||
syncSiblingAgents: true,
|
||||
});
|
||||
const codexEmail =
|
||||
typeof creds.email === "string" && creds.email.trim() ? creds.email.trim() : "default";
|
||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||
profileId: "openai-codex:default",
|
||||
profileId: `openai-codex:${codexEmail}`,
|
||||
provider: "openai-codex",
|
||||
mode: "oauth",
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue