mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 21:32:56 -07:00
feat(admin): prompt user to restart the CLI if they change auth to oauth mid-session or don't have auth type selected at start of session (#16426)
This commit is contained in:
@@ -31,6 +31,7 @@ interface AuthDialogProps {
|
||||
setAuthState: (state: AuthState) => void;
|
||||
authError: string | null;
|
||||
onAuthError: (error: string | null) => void;
|
||||
setAuthContext: (context: { requiresRestart?: boolean }) => void;
|
||||
}
|
||||
|
||||
export function AuthDialog({
|
||||
@@ -39,6 +40,7 @@ export function AuthDialog({
|
||||
setAuthState,
|
||||
authError,
|
||||
onAuthError,
|
||||
setAuthContext,
|
||||
}: AuthDialogProps): React.JSX.Element {
|
||||
const [exiting, setExiting] = useState(false);
|
||||
let items = [
|
||||
@@ -116,6 +118,11 @@ export function AuthDialog({
|
||||
return;
|
||||
}
|
||||
if (authType) {
|
||||
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
|
||||
setAuthContext({ requiresRestart: true });
|
||||
} else {
|
||||
setAuthContext({});
|
||||
}
|
||||
await clearCachedCredentialFile();
|
||||
|
||||
settings.setValue(scope, 'security.auth.selectedType', authType);
|
||||
@@ -143,7 +150,7 @@ export function AuthDialog({
|
||||
}
|
||||
setAuthState(AuthState.Unauthenticated);
|
||||
},
|
||||
[settings, config, setAuthState, exiting],
|
||||
[settings, config, setAuthState, exiting, setAuthContext],
|
||||
);
|
||||
|
||||
const handleAuthSelect = (authMethod: AuthType) => {
|
||||
|
||||
Reference in New Issue
Block a user