fix(auth): improve API key authentication flow (#13829)

This commit is contained in:
Gal Zahavi
2025-11-26 13:58:14 -08:00
committed by GitHub
parent 0d29385e1b
commit b2bdfcf1b5
4 changed files with 71 additions and 18 deletions
+13 -4
View File
@@ -116,6 +116,9 @@ export function AuthDialog({
return;
}
if (authType) {
const isInitialAuthSelection =
!settings.merged.security?.auth?.selectedType;
await clearCachedCredentialFile();
settings.setValue(scope, 'security.auth.selectedType', authType);
@@ -130,10 +133,16 @@ export function AuthDialog({
}, 100);
return;
}
}
if (authType === AuthType.USE_GEMINI) {
setAuthState(AuthState.AwaitingApiKeyInput);
return;
if (authType === AuthType.USE_GEMINI) {
if (isInitialAuthSelection && process.env['GEMINI_API_KEY']) {
setAuthState(AuthState.Unauthenticated);
return;
} else {
setAuthState(AuthState.AwaitingApiKeyInput);
return;
}
}
}
setAuthState(AuthState.Unauthenticated);
},