feat(auth): improve API key authentication flow (#11760)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Gal Zahavi
2025-10-29 18:58:08 -07:00
committed by GitHub
parent 6c8a48db13
commit 06035d5d43
25 changed files with 1216 additions and 76 deletions
+44 -38
View File
@@ -119,6 +119,10 @@ Logging in with Google... Please restart Gemini CLI to continue.
process.exit(0);
}
}
if (authType === AuthType.USE_GEMINI) {
setAuthState(AuthState.AwaitingApiKeyInput);
return;
}
setAuthState(AuthState.Unauthenticated);
},
[settings, config, setAuthState],
@@ -157,50 +161,52 @@ Logging in with Google... Please restart Gemini CLI to continue.
return (
<Box
borderStyle="round"
borderColor={theme.border.default}
flexDirection="column"
borderColor={theme.border.focused}
flexDirection="row"
padding={1}
width="100%"
alignItems="flex-start"
>
<Text bold color={theme.text.primary}>
Get started
</Text>
<Box marginTop={1}>
<Text color={theme.text.primary}>
How would you like to authenticate for this project?
<Text color={theme.text.accent}>? </Text>
<Box flexDirection="column" flexGrow={1}>
<Text bold color={theme.text.primary}>
Get started
</Text>
</Box>
<Box marginTop={1}>
<RadioButtonSelect
items={items}
initialIndex={initialAuthIndex}
onSelect={handleAuthSelect}
onHighlight={() => {
onAuthError(null);
}}
/>
</Box>
{authError && (
<Box marginTop={1}>
<Text color={theme.status.error}>{authError}</Text>
<Text color={theme.text.primary}>
How would you like to authenticate for this project?
</Text>
</Box>
<Box marginTop={1}>
<RadioButtonSelect
items={items}
initialIndex={initialAuthIndex}
onSelect={handleAuthSelect}
onHighlight={() => {
onAuthError(null);
}}
/>
</Box>
{authError && (
<Box marginTop={1}>
<Text color={theme.status.error}>{authError}</Text>
</Box>
)}
<Box marginTop={1}>
<Text color={theme.text.secondary}>(Use Enter to select)</Text>
</Box>
<Box marginTop={1}>
<Text color={theme.text.primary}>
Terms of Services and Privacy Notice for Gemini CLI
</Text>
</Box>
<Box marginTop={1}>
<Text color={theme.text.link}>
{
'https://github.com/google-gemini/gemini-cli/blob/main/docs/tos-privacy.md'
}
</Text>
</Box>
)}
<Box marginTop={1}>
<Text color={theme.text.secondary}>
(Use Enter to select, Esc to close)
</Text>
</Box>
<Box marginTop={1}>
<Text color={theme.text.primary}>
Terms of Services and Privacy Notice for Gemini CLI
</Text>
</Box>
<Box marginTop={1}>
<Text color={theme.text.link}>
{
'https://github.com/google-gemini/gemini-cli/blob/main/docs/tos-privacy.md'
}
</Text>
</Box>
</Box>
);