From 9897a2b80a6f371363faf1345f406ea581b841db Mon Sep 17 00:00:00 2001 From: Marat Boshernitsan Date: Wed, 25 Jun 2025 09:11:54 -0700 Subject: [PATCH] Clarify why authentication failures might be happening and direct users to documentation (#1478) Co-authored-by: Scott Densmore Co-authored-by: matt korwel --- docs/cli/authentication.md | 12 +++++++++--- packages/cli/src/ui/components/AuthDialog.tsx | 2 +- packages/cli/src/ui/hooks/useAuthCommand.ts | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/cli/authentication.md b/docs/cli/authentication.md index e4d83db7..bb9fea84 100644 --- a/docs/cli/authentication.md +++ b/docs/cli/authentication.md @@ -22,10 +22,16 @@ The Gemini CLI requires you to authenticate with Google's AI services. On initia source ~/.bashrc ``` -3. **Login with Google Workspace** +3. **Login with Google (Gemini Code Assist for Workspace or licensed Code Assist users):** - - Use this option to log in with the **Google Workspace Accounts**. This is a paid service for businesses and organizations that provides a suite of productivity tools, including a custom email domain (e.g. your-name@your-company.com), enhanced security features, and administrative controls. These accounts are often managed by an employer or school. - - Google Workspace Account must first configure a Google Cloud Project Id to use, [enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api) and [configure access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam). You can temporarily set the environment variable in your current shell session using the following command: + (For more information, see: https://developers.google.com/gemini-code-assist/resources/faqs#gcp-project-requirement) + + - Use this option if: + + 1. You have a Google Workspace account. Google Workspace is a paid service for businesses and organizations that provides a suite of productivity tools, including a custom email domain (e.g. your-name@your-company.com), enhanced security features, and administrative controls. These accounts are often managed by an employer or school. + 2. You are a licensed Code Assist user. This can happen if you have previously purchased a Code Assist license or have acquired one through Google Developer Program. + + - If you fall into one of these categories, you must first configure a Google Cloud Project Id to use, [enable the Gemini for Cloud API](https://cloud.google.com/gemini/docs/discover/set-up-gemini#enable-api) and [configure access permissions](https://cloud.google.com/gemini/docs/discover/set-up-gemini#grant-iam). You can temporarily set the environment variable in your current shell session using the following command: ```bash export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" ``` diff --git a/packages/cli/src/ui/components/AuthDialog.tsx b/packages/cli/src/ui/components/AuthDialog.tsx index 2db9c080..6ff9268e 100644 --- a/packages/cli/src/ui/components/AuthDialog.tsx +++ b/packages/cli/src/ui/components/AuthDialog.tsx @@ -35,7 +35,7 @@ export function AuthDialog({ }, { label: 'Gemini API Key', value: AuthType.USE_GEMINI }, { - label: 'Login with Google Workspace', + label: 'Login with Google (for Workspace or licensed Code Assist users)', value: AuthType.LOGIN_WITH_GOOGLE_ENTERPRISE, }, { label: 'Vertex AI', value: AuthType.USE_VERTEX_AI }, diff --git a/packages/cli/src/ui/hooks/useAuthCommand.ts b/packages/cli/src/ui/hooks/useAuthCommand.ts index bccb285e..445b184b 100644 --- a/packages/cli/src/ui/hooks/useAuthCommand.ts +++ b/packages/cli/src/ui/hooks/useAuthCommand.ts @@ -49,7 +49,7 @@ export const useAuthCommand = ( const errorMessage = settings.merged.selectedAuthType === AuthType.LOGIN_WITH_GOOGLE_PERSONAL - ? `Failed to login. Ensure your Google account is not a Workspace account. + ? `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)}`; setAuthError(errorMessage);