fix(auth): Remove sharp edges from headless auth (#3985)

This commit is contained in:
N. Taylor Mullen
2025-07-12 15:42:47 -07:00
committed by GitHub
parent 890982a811
commit 4442e893c3
8 changed files with 118 additions and 85 deletions

View File

@@ -12,6 +12,7 @@ import {
clearCachedCredentialFile,
getErrorMessage,
} from '@google/gemini-cli-core';
import { runExitCleanup } from '../../utils/cleanup.js';
export const useAuthCommand = (
settings: LoadedSettings,
@@ -55,11 +56,22 @@ export const useAuthCommand = (
if (authType) {
await clearCachedCredentialFile();
settings.setValue(scope, 'selectedAuthType', authType);
if (authType === AuthType.LOGIN_WITH_GOOGLE && config.getNoBrowser()) {
runExitCleanup();
console.log(
`
----------------------------------------------------------------
Logging in with Google... Please restart Gemini CLI to continue.
----------------------------------------------------------------
`,
);
process.exit(0);
}
}
setIsAuthDialogOpen(false);
setAuthError(null);
},
[settings, setAuthError],
[settings, setAuthError, config],
);
const cancelAuthentication = useCallback(() => {