From 79c647d486a5ef3cf9eb68f23000525e8d2c4a91 Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Wed, 25 Jun 2025 15:38:18 -0700 Subject: Merge "Login with Google Workspace" auth option into "Login with Google" (#1574) Co-authored-by: Scott Densmore --- packages/cli/src/ui/hooks/useAuthCommand.ts | 14 +++++++++----- packages/cli/src/ui/hooks/useGeminiStream.test.tsx | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'packages/cli/src/ui/hooks') diff --git a/packages/cli/src/ui/hooks/useAuthCommand.ts b/packages/cli/src/ui/hooks/useAuthCommand.ts index 445b184b..283572d2 100644 --- a/packages/cli/src/ui/hooks/useAuthCommand.ts +++ b/packages/cli/src/ui/hooks/useAuthCommand.ts @@ -46,12 +46,16 @@ export const useAuthCommand = ( config, ); } catch (e) { - const errorMessage = + let errorMessage = `Failed to login.\nMessage: ${getErrorMessage(e)}`; + if ( settings.merged.selectedAuthType === - AuthType.LOGIN_WITH_GOOGLE_PERSONAL - ? `Failed to login. Ensure the Google account you are using is not a Workspace account and that you are not a licensed Code Assist user (see https://goo.gle/gemini-cli-auth-docs#workspace-gca). -Message: ${getErrorMessage(e)}` - : `Failed to login. Message: ${getErrorMessage(e)}`; + AuthType.LOGIN_WITH_GOOGLE_PERSONAL && + !process.env.GOOGLE_CLOUD_PROJECT + ) { + errorMessage = + 'Failed to login. Workspace accounts and licensed Code Assist users must configure' + + ` GOOGLE_CLOUD_PROJECT (see https://goo.gle/gemini-cli-auth-docs#workspace-gca).\nMessage: ${getErrorMessage(e)}`; + } setAuthError(errorMessage); openAuthDialog(); } finally { diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 3da95ffd..5ac9aaa7 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -1043,7 +1043,7 @@ describe('useGeminiStream', () => { it('should call parseAndFormatApiError with the correct authType on stream initialization failure', async () => { // 1. Setup const mockError = new Error('Rate limit exceeded'); - const mockAuthType = AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE; + const mockAuthType = AuthType.LOGIN_WITH_GOOGLE_PERSONAL; mockParseAndFormatApiError.mockClear(); mockSendMessageStream.mockReturnValue( (async function* () { -- cgit v1.2.3