gcloud-auth-verification
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHandling Authentication Issues
处理认证问题
Common Error Messages
常见错误信息
- gcloud/bq CLI:
ERROR: (bq) You do not currently have an active account selected.No credentialed accounts.Configuration error: No account is currently active.
- Execution Failures (Python/Notebooks):
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials.- (when it's clearly an auth issue).
Forbidden: 403 Access Denied
- gcloud/bq CLI:
ERROR: (bq) You do not currently have an active account selected.No credentialed accounts.Configuration error: No account is currently active.
- 执行失败(Python/笔记本):
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials.- (当明确是认证问题时)。
Forbidden: 403 Access Denied
Verification Step
验证步骤
Before asking the user to log in, independently verify the authentication status
by running: * If the output contains , proceed to the Corrective Action steps below. * If an account
is listed but the user still receives a error, the issue
is likely IAM permissions (e.g., missing BigQuery roles) on their active
account, rather than missing authentication. In this case, investigate the
permissions rather than asking them to log in again.
gcloud auth listNo credentialed accounts.403 Access Denied在要求用户登录之前,先独立运行以下命令验证认证状态:
gcloud auth list- 如果输出包含,请执行下方的纠正措施步骤。
No credentialed accounts. - 如果列出了账户,但用户仍收到错误,问题可能出在其活跃账户的IAM权限(例如缺少BigQuery角色),而非认证缺失。这种情况下,应排查权限问题,而非再次要求用户登录。
403 Access Denied
Corrective Action
纠正措施
When missing credentials are confirmed, DO NOT attempt to fix the
credentials via code or alternative tools. Credentials must be established by
the user.
Stop and ask the user to run the following commands in their terminal:
-
To authenticate the gcloud CLI:
gcloud auth login -
To set up Application Default Credentials (ADC) (required for BQ CLI AND most libraries/notebooks):
gcloud auth application-default login
确认凭证缺失后,请勿尝试通过代码或其他工具修复凭证。凭证必须由用户自行建立。
请暂停操作并要求用户在终端中运行以下命令:
-
认证gcloud CLI:
gcloud auth login -
设置Application Default Credentials (ADC)(BQ CLI及大多数库/笔记本均需此操作):
gcloud auth application-default login
Post-Login Verification
登录后验证
After the user confirms they have logged in, verify with:
Then proceed with the original task.
gcloud auth list用户确认登录后,运行以下命令验证:
随后继续执行原任务。
gcloud auth list