summaryrefslogtreecommitdiff
path: root/packages/core/src/code_assist/codeAssist.ts
diff options
context:
space:
mode:
authormatt korwel <[email protected]>2025-06-19 16:52:22 -0700
committerGitHub <[email protected]>2025-06-19 16:52:22 -0700
commit04518b52c0ddcd5ae1192763c55e472add218b3c (patch)
tree2587b0ccc5460e9e94eb8b715956cb713950f7c8 /packages/core/src/code_assist/codeAssist.ts
parentc48fcaa8c3fe8175718b1bbfc7770a958012173c (diff)
Auth First Run (#1207)
Co-authored-by: Tommaso Sciortino <[email protected]> Co-authored-by: N. Taylor Mullen <[email protected]>
Diffstat (limited to 'packages/core/src/code_assist/codeAssist.ts')
-rw-r--r--packages/core/src/code_assist/codeAssist.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/core/src/code_assist/codeAssist.ts b/packages/core/src/code_assist/codeAssist.ts
index 4b46f8b9..1ceb818b 100644
--- a/packages/core/src/code_assist/codeAssist.ts
+++ b/packages/core/src/code_assist/codeAssist.ts
@@ -4,15 +4,23 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { ContentGenerator } from '../core/contentGenerator.js';
+import { AuthType, ContentGenerator } from '../core/contentGenerator.js';
import { getOauthClient } from './oauth2.js';
import { setupUser } from './setup.js';
import { CodeAssistServer, HttpOptions } from './server.js';
export async function createCodeAssistContentGenerator(
httpOptions: HttpOptions,
+ authType: AuthType,
): Promise<ContentGenerator> {
- const authClient = await getOauthClient();
- const projectId = await setupUser(authClient);
- return new CodeAssistServer(authClient, projectId, httpOptions);
+ if (
+ authType === AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE ||
+ authType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL
+ ) {
+ const authClient = await getOauthClient();
+ const projectId = await setupUser(authClient);
+ return new CodeAssistServer(authClient, projectId, httpOptions);
+ }
+
+ throw new Error(`Unsupported authType: ${authType}`);
}