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:
Shreya Keshive
2026-01-12 15:39:08 -05:00
committed by GitHub
parent 2306e60be4
commit d65eab01d2
10 changed files with 207 additions and 2 deletions
+8 -1
View File
@@ -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) => {