Add NO_BROWSER environment variable to trigger offline oauth flow (#3713)

This commit is contained in:
Seth Troisi
2025-07-10 18:59:02 -07:00
committed by GitHub
parent ab66e3a24e
commit 8a128d8dc6
11 changed files with 169 additions and 35 deletions

View File

@@ -8,17 +8,19 @@ import { AuthType, ContentGenerator } from '../core/contentGenerator.js';
import { getOauthClient } from './oauth2.js';
import { setupUser } from './setup.js';
import { CodeAssistServer, HttpOptions } from './server.js';
import { Config } from '../config/config.js';
export async function createCodeAssistContentGenerator(
httpOptions: HttpOptions,
authType: AuthType,
config: Config,
sessionId?: string,
): Promise<ContentGenerator> {
if (
authType === AuthType.LOGIN_WITH_GOOGLE ||
authType === AuthType.CLOUD_SHELL
) {
const authClient = await getOauthClient(authType);
const authClient = await getOauthClient(authType, config);
const projectId = await setupUser(authClient);
return new CodeAssistServer(authClient, projectId, httpOptions, sessionId);
}