[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AFSHJNJ1694Z5NSZF8SNS3":3,"skill-same:01M6AFSHJNJ1694Z5NSZF8SNS3":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":55,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6AFSHJNJ1694Z5NSZF8SNS3","google-cloud-auth",null,"Provides expert guidance on authenticating and authorizing to Google Cloud services and APIs, covering human users, service identities, Application Default Credentials (ADC), and best practices for secure access.","davila7\u002Fclaude-code-templates","davila7","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6216945?v=4","01M6ADEWWFPS191NFM0Y1EX1JH","Daniel Avila","01M6ADJHGM78PHQRD3XZTFDVKK",33481,"MIT","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fgoogle-cloud-auth\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"google cloud","google cloud auth","cloud","auth","google","secure","best practices","apache","services","credentials","access","guidance","default","expert","application","human","service","users","for","2026-11-10 10:12:30",false,"---\nname: google-cloud-auth\ndescription: Provides expert guidance on authenticating and authorizing to Google Cloud services and APIs, covering human users, service identities, Application Default Credentials (ADC), and best practices for secure access.\nmetadata:\n  source: google\u002Fskills (Apache 2.0)\n---\n\n# Authenticating to Google Cloud\n\n[Authentication](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication) is the\nprocess of proving **who you are**. In Google Cloud, you represent a\n**Principal** (an identity like a user or a service). This is the first step\nbefore [Authorization](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Foverview)\n(determining **what you can do**).\n\n## Authentication\n\n### Clarifying Questions for the Agent\n\nBefore providing a specific solution, clarify the following with the user:\n\n1.  **Who or what is authenticating?** (A human developer, a local script, or an\n    application running in production?)\n2.  **Where is the code running?** (Local laptop, [Compute\n    Engine](https:\u002F\u002Fdocs.cloud.google.com\u002Fcompute\u002Fdocs),\n    [GKE](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs), [Cloud\n    Run](https:\u002F\u002Fdocs.cloud.google.com\u002Frun\u002Fdocs), or another cloud like\n    AWS\u002FAzure?)\n3.  **What is the target?** (A Google Cloud API like Storage\u002FBigQuery, or a\n    custom application you built?)\n4.  **Are you using a high-level client library?** (e.g., Python, Go, Node.js\n    libraries usually handle ADC automatically.)\n\n---\n\n## Human Authentication\n\nFor users to access Google Cloud, they need an identity that Google Cloud can\nrecognize.\n\n### Types of User Identities\n\nGoogle Cloud supports several ways to configure identities for your internal\nworkforce (developers, administrators, employees):\n\n*   **[Google-Managed\n    Accounts](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities#google-accounts)**:\n    You can use Cloud Identity or Google Workspace to create managed user\n    accounts. These are called managed accounts because your organization\n    controls their lifecycle and configuration.\n*   **[Federation using Cloud Identity or Google\n    Workspace](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities#synced-federation)**:\n    You can federate identities to allow users to use their existing identity\n    and credentials to sign in to Google services. Users authenticate against an\n    external identity provider (IdP), but you must keep accounts synchronized\n    into Google Cloud using tools like Google Cloud Directory Sync (GCDS) or an\n    external authoritative source like Active Directory or Microsoft Entra ID.\n*   **[Workforce Identity\n    Federation](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities#workforce)**:\n    This lets you use an external IdP to authenticate and authorize a workforce\n    using IAM directly. Unlike standard federation, you do not need to\n    synchronize user identities from your existing IdP to Google Cloud\n    identities. It supports syncless, attribute-based single sign-on.\n\n### Methods of Access for Developers and Administrators\n\nUsed for interacting with Google Cloud resources and APIs during development and\nmanagement.\n\n*   **[Google Cloud Console](https:\u002F\u002Fconsole.cloud.google.com\u002F)**: The primary\n    web interface. You authenticate using your Google Account (Gmail or [Google\n    Workspace](https:\u002F\u002Fworkspace.google.com\u002F)).\n*   **[gcloud CLI](https:\u002F\u002Fdocs.cloud.google.com\u002Fsdk\u002Fdocs\u002Finstall-sdk) (`gcloud\n    auth login`)**: Used to authenticate the CLI itself so you can run\n    management commands (e.g., `gcloud compute instances list`). It uses a\n    **Credential** (like an OAuth 2.0 refresh token) stored locally.\n*   **Local Development with [App Default Credentials\n    (ADC)](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fapplication-default-credentials)\n    (`gcloud auth application-default login`)**: This is different from CLI\n    auth. It creates a local JSON file that Google Cloud **Client Libraries**\n    (Python, Java, etc.) use to act as \"you\" when you run code on your laptop.\n*   **[Service Account\n    Impersonation](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fuse-service-account-impersonation)**:\n    For security reasons, developers should avoid downloading Service Account\n    keys entirely. Instead, they should authenticate as humans (`gcloud auth\n    login`) and use Service Account Impersonation to run CLI commands or\n    generate short-lived credentials. This is a critical best practice for local\n    development and troubleshooting.\n\n### For End-Users and Customers\n\nUsed when a human (who is not a developer) needs to access a web application\nyou've deployed on Google Cloud. Note: These are distinct from workforce\nidentities.\n\n*   **[Identity-Aware Proxy (IAP)](https:\u002F\u002Fdocs.cloud.google.com\u002Fiap\u002Fdocs)**:\n    Acts as a central authorization layer for web applications. It intercepts\n    web requests and verifies the user's identity (via Google Workspace, Cloud\n    Identity, or external providers) before letting them reach the application.\n    It's often used to protect internal apps without a VPN, or secure customer\n    portals.\n*   **[Identity\n    Platform](https:\u002F\u002Fdocs.cloud.google.com\u002Fidentity-platform\u002Fdocs)**: A\n    Customer Identity and Access Management (CIAM) solution for adding consumer\n    sign-in (email\u002Fpassword, phone, social) directly into the code of your\n    custom-built applications.\n\n---\n\n## Service-to-Service Authentication\n\nWhen code runs in production, it should use a **Service Account** rather than a\nhuman user account.\n\n### Service Accounts and Service Agents\n\n*   **[Service\n    Account](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fservice-account-overview)**:\n    A special identity intended for non-human users. It's like a \"robot\n    identity\" with its own email address.\n*   **[Service Agent](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fservice-agents)**:\n    A service account managed by Google that allows a service (like Pub\u002FSub) to\n    access your resources on your behalf.\n\n### Best Practice: Attaching Service Accounts\n\nInstead of using **Service Account Keys** (dangerous JSON files), you should\n**attach** a custom service account to the Google Cloud resource. The resource's\nenvironment then provides a **Token** (a short-lived digital object) via a local\nmetadata server.\n\n*   **[Compute\n    Engine](https:\u002F\u002Fdocs.cloud.google.com\u002Fcompute\u002Fdocs\u002Faccess\u002Fcreate-enable-service-accounts-for-instances)**:\n    Assign a service account during VM creation.\n*   **[Cloud\n    Run](https:\u002F\u002Fdocs.cloud.google.com\u002Frun\u002Fdocs\u002Fsecuring\u002Fservice-identity)**:\n    Assign a service account in the service configuration.\n\n### Special Cases & Advanced Topics\n\n#### Kubernetes Engine (GKE)\n\nUse **[Workload Identity Federation for\nGKE](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Fhow-to\u002Fworkload-identity)**\nto map Kubernetes identities to IAM principal identifiers. This grants specific\nKubernetes workloads access to specific Google Cloud APIs. [Learn more\nhere.](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Fhow-to\u002Fworkload-identity#configure-authz-principals)\n\n#### External Workloads ([Workload Identity Federation](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fworkload-identity-federation))\n\nFor code running **outside** Google Cloud (e.g., AWS, Azure, or on-prem), do not\nuse keys. Instead, use Workload Identity Federation to exchange an external\ntoken (like an AWS IAM role) for a short-lived Google Cloud access token.\n\n#### [API Keys](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fapi-keys)\n\nAPI keys are encrypted strings used for public data (e.g., Google Maps) or\nsimplified access like **[Vertex AI Express\nMode](https:\u002F\u002Fdocs.cloud.google.com\u002Fvertex-ai\u002Fgenerative-ai\u002Fdocs\u002Fstart\u002Fexpress-mode\u002Foverview)**,\nwhich allows fast testing of Gemini models without complex setup. Both humans\nand services (e.g., Cloud Run-based AI agent) can use API keys, for the services\nthat support it.\n\nNote: API keys should be\n[restricted](https:\u002F\u002Fdocs.cloud.google.com\u002Fapi-keys\u002Fdocs\u002Fadd-restrictions-api-keys)\nto specific APIs and projects to minimize security risks. Store API keys in a\nsecrets manager like [Secret\nManager](https:\u002F\u002Fdocs.cloud.google.com\u002Fsecret-manager\u002Fdocs) to prevent\naccidental exposure.\n\n#### OAuth 2.0 Access Scopes\n\nWhile IAM is the modern way to handle authorization, legacy Compute Engine VMs\nand GKE node pools still rely on **Access Scopes** alongside IAM. If a VM's\nscope is restricted, the attached service account will fail to make API calls\neven if it has the correct IAM permissions. Check this first if attached service\naccounts are failing unexpectedly.\n\n#### Short-Lived Credentials\n\nThe underlying mechanism for impersonation and secure service-to-service\ncommunication is the **IAM Service Account Credentials API**. This API generates\nshort-lived access tokens, OpenID Connect (OIDC) ID tokens, or self-signed JSON\nWeb Tokens (JWTs) dynamically, removing the need for static credentials.\n\n---\n\n## Authorization\n\nAfter Authentication, Google Cloud uses **[Identity and Access Management\n(IAM)](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Foverview)** to determine what the\nauthenticated principal can do.\n\n*   **Allow Policy**: A record that binds a **Principal** to a **Role** on a\n    **Resource**.\n*   **[Predefined\n    Roles](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Funderstanding-roles)**:\n    Prebuilt roles like `roles\u002Fstorage.objectViewer` or\n    `roles\u002Fbigquery.dataEditor`. **Always try to use these first.**\n*   **[Custom\n    Roles](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fcreating-custom-roles)**:\n    User-defined collections of specific permissions if predefined roles are too\n    broad.\n\n---\n\n## Examples\n\n### Human-to-Service (Local Python Development)\n\n1.  **Authn**: Run `gcloud auth application-default login` to create local\n    credentials (ADC).\n2.  **Authz**: Grant your email the `roles\u002Fstorage.objectViewer` role on a\n    bucket.\n3.  **Code**: Use the Python `storage.Client()`. It automatically finds your\n    local credentials via ADC. *Note: ADC searches in a specific order—first\n    checking the `GOOGLE_APPLICATION_CREDENTIALS` environment variable, then the\n    local gcloud JSON file, and finally the attached service account metadata\n    server.*\n\n### Service-to-Service (Cloud Run to Cloud SQL)\n\n1.  **Authn**: Attach a custom Service Account to your Cloud Run service.\n2.  **Authz**: Grant that Service Account the `roles\u002Fcloudsql.client` role on\n    the project.\n3.  **Code**: The Cloud Run environment provides the token automatically to the\n    connection driver.\n\n### Calling a Custom Application ([OIDC](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fget-id-token))\n\nWhen calling a private Cloud Run service from another service, the caller\ngenerates a Google-signed **OpenID Connect (OIDC) ID Token** and passes it in\nthe `Authorization: Bearer \u003CTOKEN>` header.\n\n---\n\n## Validation Checklist\n\n-   [ ] Is the user running code locally? Suggest `gcloud auth\n    application-default login` or **Service Account Impersonation**.\n-   [ ] Is the user attempting to use Service Account keys locally? Strongly\n    discourage this and recommend impersonation.\n-   [ ] Is the user running in production? Recommend attaching a custom,\n    least-privilege service account, NOT using keys.\n-   [ ] Is the user relying on the Compute Engine Default Service Account?\n    Recommend creating a custom service account instead.\n-   [ ] Is the user running on another cloud? Recommend Workload Identity\n    Federation.\n-   [ ] Is the user calling a custom app? Recommend OIDC ID Tokens.\n-   [ ] Has the user restricted their API Keys? Check for appropriate [API Key\n    Restrictions](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fapi-keys#adding-application-restrictions).\n\n## References\n\n-   [Authentication Overview](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication)\n-   [User Identities](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities)\n-   [Application Default Credentials](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fprovide-credentials-adc)\n-   [Service Account Best Practices](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fbest-practices-service-accounts)\n","# Authenticating to Google Cloud\n\n[Authentication](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication) is the\nprocess of proving **who you are**. In Google Cloud, you represent a\n**Principal** (an identity like a user or a service). This is the first step\nbefore [Authorization](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Foverview)\n(determining **what you can do**).\n\n## Authentication\n\n### Clarifying Questions for the Agent\n\nBefore providing a specific solution, clarify the following with the user:\n\n1.  **Who or what is authenticating?** (A human developer, a local script, or an\n    application running in production?)\n2.  **Where is the code running?** (Local laptop, [Compute\n    Engine](https:\u002F\u002Fdocs.cloud.google.com\u002Fcompute\u002Fdocs),\n    [GKE](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs), [Cloud\n    Run](https:\u002F\u002Fdocs.cloud.google.com\u002Frun\u002Fdocs), or another cloud like\n    AWS\u002FAzure?)\n3.  **What is the target?** (A Google Cloud API like Storage\u002FBigQuery, or a\n    custom application you built?)\n4.  **Are you using a high-level client library?** (e.g., Python, Go, Node.js\n    libraries usually handle ADC automatically.)\n\n---\n\n## Human Authentication\n\nFor users to access Google Cloud, they need an identity that Google Cloud can\nrecognize.\n\n### Types of User Identities\n\nGoogle Cloud supports several ways to configure identities for your internal\nworkforce (developers, administrators, employees):\n\n*   **[Google-Managed\n    Accounts](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities#google-accounts)**:\n    You can use Cloud Identity or Google Workspace to create managed user\n    accounts. These are called managed accounts because your organization\n    controls their lifecycle and configuration.\n*   **[Federation using Cloud Identity or Google\n    Workspace](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities#synced-federation)**:\n    You can federate identities to allow users to use their existing identity\n    and credentials to sign in to Google services. Users authenticate against an\n    external identity provider (IdP), but you must keep accounts synchronized\n    into Google Cloud using tools like Google Cloud Directory Sync (GCDS) or an\n    external authoritative source like Active Directory or Microsoft Entra ID.\n*   **[Workforce Identity\n    Federation](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities#workforce)**:\n    This lets you use an external IdP to authenticate and authorize a workforce\n    using IAM directly. Unlike standard federation, you do not need to\n    synchronize user identities from your existing IdP to Google Cloud\n    identities. It supports syncless, attribute-based single sign-on.\n\n### Methods of Access for Developers and Administrators\n\nUsed for interacting with Google Cloud resources and APIs during development and\nmanagement.\n\n*   **[Google Cloud Console](https:\u002F\u002Fconsole.cloud.google.com\u002F)**: The primary\n    web interface. You authenticate using your Google Account (Gmail or [Google\n    Workspace](https:\u002F\u002Fworkspace.google.com\u002F)).\n*   **[gcloud CLI](https:\u002F\u002Fdocs.cloud.google.com\u002Fsdk\u002Fdocs\u002Finstall-sdk) (`gcloud\n    auth login`)**: Used to authenticate the CLI itself so you can run\n    management commands (e.g., `gcloud compute instances list`). It uses a\n    **Credential** (like an OAuth 2.0 refresh token) stored locally.\n*   **Local Development with [App Default Credentials\n    (ADC)](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fapplication-default-credentials)\n    (`gcloud auth application-default login`)**: This is different from CLI\n    auth. It creates a local JSON file that Google Cloud **Client Libraries**\n    (Python, Java, etc.) use to act as \"you\" when you run code on your laptop.\n*   **[Service Account\n    Impersonation](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fuse-service-account-impersonation)**:\n    For security reasons, developers should avoid downloading Service Account\n    keys entirely. Instead, they should authenticate as humans (`gcloud auth\n    login`) and use Service Account Impersonation to run CLI commands or\n    generate short-lived credentials. This is a critical best practice for local\n    development and troubleshooting.\n\n### For End-Users and Customers\n\nUsed when a human (who is not a developer) needs to access a web application\nyou've deployed on Google Cloud. Note: These are distinct from workforce\nidentities.\n\n*   **[Identity-Aware Proxy (IAP)](https:\u002F\u002Fdocs.cloud.google.com\u002Fiap\u002Fdocs)**:\n    Acts as a central authorization layer for web applications. It intercepts\n    web requests and verifies the user's identity (via Google Workspace, Cloud\n    Identity, or external providers) before letting them reach the application.\n    It's often used to protect internal apps without a VPN, or secure customer\n    portals.\n*   **[Identity\n    Platform](https:\u002F\u002Fdocs.cloud.google.com\u002Fidentity-platform\u002Fdocs)**: A\n    Customer Identity and Access Management (CIAM) solution for adding consumer\n    sign-in (email\u002Fpassword, phone, social) directly into the code of your\n    custom-built applications.\n\n---\n\n## Service-to-Service Authentication\n\nWhen code runs in production, it should use a **Service Account** rather than a\nhuman user account.\n\n### Service Accounts and Service Agents\n\n*   **[Service\n    Account](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fservice-account-overview)**:\n    A special identity intended for non-human users. It's like a \"robot\n    identity\" with its own email address.\n*   **[Service Agent](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fservice-agents)**:\n    A service account managed by Google that allows a service (like Pub\u002FSub) to\n    access your resources on your behalf.\n\n### Best Practice: Attaching Service Accounts\n\nInstead of using **Service Account Keys** (dangerous JSON files), you should\n**attach** a custom service account to the Google Cloud resource. The resource's\nenvironment then provides a **Token** (a short-lived digital object) via a local\nmetadata server.\n\n*   **[Compute\n    Engine](https:\u002F\u002Fdocs.cloud.google.com\u002Fcompute\u002Fdocs\u002Faccess\u002Fcreate-enable-service-accounts-for-instances)**:\n    Assign a service account during VM creation.\n*   **[Cloud\n    Run](https:\u002F\u002Fdocs.cloud.google.com\u002Frun\u002Fdocs\u002Fsecuring\u002Fservice-identity)**:\n    Assign a service account in the service configuration.\n\n### Special Cases & Advanced Topics\n\n#### Kubernetes Engine (GKE)\n\nUse **[Workload Identity Federation for\nGKE](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Fhow-to\u002Fworkload-identity)**\nto map Kubernetes identities to IAM principal identifiers. This grants specific\nKubernetes workloads access to specific Google Cloud APIs. [Learn more\nhere.](https:\u002F\u002Fdocs.cloud.google.com\u002Fkubernetes-engine\u002Fdocs\u002Fhow-to\u002Fworkload-identity#configure-authz-principals)\n\n#### External Workloads ([Workload Identity Federation](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fworkload-identity-federation))\n\nFor code running **outside** Google Cloud (e.g., AWS, Azure, or on-prem), do not\nuse keys. Instead, use Workload Identity Federation to exchange an external\ntoken (like an AWS IAM role) for a short-lived Google Cloud access token.\n\n#### [API Keys](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fapi-keys)\n\nAPI keys are encrypted strings used for public data (e.g., Google Maps) or\nsimplified access like **[Vertex AI Express\nMode](https:\u002F\u002Fdocs.cloud.google.com\u002Fvertex-ai\u002Fgenerative-ai\u002Fdocs\u002Fstart\u002Fexpress-mode\u002Foverview)**,\nwhich allows fast testing of Gemini models without complex setup. Both humans\nand services (e.g., Cloud Run-based AI agent) can use API keys, for the services\nthat support it.\n\nNote: API keys should be\n[restricted](https:\u002F\u002Fdocs.cloud.google.com\u002Fapi-keys\u002Fdocs\u002Fadd-restrictions-api-keys)\nto specific APIs and projects to minimize security risks. Store API keys in a\nsecrets manager like [Secret\nManager](https:\u002F\u002Fdocs.cloud.google.com\u002Fsecret-manager\u002Fdocs) to prevent\naccidental exposure.\n\n#### OAuth 2.0 Access Scopes\n\nWhile IAM is the modern way to handle authorization, legacy Compute Engine VMs\nand GKE node pools still rely on **Access Scopes** alongside IAM. If a VM's\nscope is restricted, the attached service account will fail to make API calls\neven if it has the correct IAM permissions. Check this first if attached service\naccounts are failing unexpectedly.\n\n#### Short-Lived Credentials\n\nThe underlying mechanism for impersonation and secure service-to-service\ncommunication is the **IAM Service Account Credentials API**. This API generates\nshort-lived access tokens, OpenID Connect (OIDC) ID tokens, or self-signed JSON\nWeb Tokens (JWTs) dynamically, removing the need for static credentials.\n\n---\n\n## Authorization\n\nAfter Authentication, Google Cloud uses **[Identity and Access Management\n(IAM)](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Foverview)** to determine what the\nauthenticated principal can do.\n\n*   **Allow Policy**: A record that binds a **Principal** to a **Role** on a\n    **Resource**.\n*   **[Predefined\n    Roles](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Funderstanding-roles)**:\n    Prebuilt roles like `roles\u002Fstorage.objectViewer` or\n    `roles\u002Fbigquery.dataEditor`. **Always try to use these first.**\n*   **[Custom\n    Roles](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fcreating-custom-roles)**:\n    User-defined collections of specific permissions if predefined roles are too\n    broad.\n\n---\n\n## Examples\n\n### Human-to-Service (Local Python Development)\n\n1.  **Authn**: Run `gcloud auth application-default login` to create local\n    credentials (ADC).\n2.  **Authz**: Grant your email the `roles\u002Fstorage.objectViewer` role on a\n    bucket.\n3.  **Code**: Use the Python `storage.Client()`. It automatically finds your\n    local credentials via ADC. *Note: ADC searches in a specific order—first\n    checking the `GOOGLE_APPLICATION_CREDENTIALS` environment variable, then the\n    local gcloud JSON file, and finally the attached service account metadata\n    server.*\n\n### Service-to-Service (Cloud Run to Cloud SQL)\n\n1.  **Authn**: Attach a custom Service Account to your Cloud Run service.\n2.  **Authz**: Grant that Service Account the `roles\u002Fcloudsql.client` role on\n    the project.\n3.  **Code**: The Cloud Run environment provides the token automatically to the\n    connection driver.\n\n### Calling a Custom Application ([OIDC](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fget-id-token))\n\nWhen calling a private Cloud Run service from another service, the caller\ngenerates a Google-signed **OpenID Connect (OIDC) ID Token** and passes it in\nthe `Authorization: Bearer \u003CTOKEN>` header.\n\n---\n\n## Validation Checklist\n\n-   [ ] Is the user running code locally? Suggest `gcloud auth\n    application-default login` or **Service Account Impersonation**.\n-   [ ] Is the user attempting to use Service Account keys locally? Strongly\n    discourage this and recommend impersonation.\n-   [ ] Is the user running in production? Recommend attaching a custom,\n    least-privilege service account, NOT using keys.\n-   [ ] Is the user relying on the Compute Engine Default Service Account?\n    Recommend creating a custom service account instead.\n-   [ ] Is the user running on another cloud? Recommend Workload Identity\n    Federation.\n-   [ ] Is the user calling a custom app? Recommend OIDC ID Tokens.\n-   [ ] Has the user restricted their API Keys? Check for appropriate [API Key\n    Restrictions](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fapi-keys#adding-application-restrictions).\n\n## References\n\n-   [Authentication Overview](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication)\n-   [User Identities](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fuser-identities)\n-   [Application Default Credentials](https:\u002F\u002Fdocs.cloud.google.com\u002Fdocs\u002Fauthentication\u002Fprovide-credentials-adc)\n-   [Service Account Best Practices](https:\u002F\u002Fdocs.cloud.google.com\u002Fiam\u002Fdocs\u002Fbest-practices-service-accounts)\n",{"name":5,"metadata":48,"description":7},{"source":49},"google\u002Fskills (Apache 2.0)","main","2b749c82b5d11fac39d9a6e021ce3f5b8a541bd1","cli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fgoogle-cloud-auth",3931,"https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates","https:\u002F\u002Faitmpl.com","https:\u002F\u002Fgithub.com\u002Fdavila7","https:\u002F\u002Fdanielavila.me","Building AI dev tools with LLMs","2026-11-14 06:14:46",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add davila7\u002Fclaude-code-templates --skill google-cloud-auth",{"tool":66,"command":67},"bunx","bunx skills add davila7\u002Fclaude-code-templates --skill google-cloud-auth",{"tool":69,"command":70},"pnpm","pnpm dlx skills add davila7\u002Fclaude-code-templates --skill google-cloud-auth","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fgoogle-cloud-auth\u002FSKILL.md",true,[],[75,102,129,161,196,220],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":82,"publishedAt":43},"01M70NHBTQ8BV0A2SCAZXEPHCX","wealthville-pool-scoring","Score DeFi liquidity pools before providing liquidity. Returns a 0-100 pool score and an Enter\u002FHold\u002FExit\u002FReduce\u002FAvoid verdict with calibrated confidence for ~68,800 Solana pools and 575 EVM pools, plus a public miss-inclusive track record. Use when asked whether a pool is worth LPing into, which pools look best right now, or how accurate the scores have actually been.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fweb-data\u002Fwealthville-pool-scoring\u002FSKILL.md",[81],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[83,84,85,86,87,42,88,89,90,91,92,93,94,95,96,97,98,99,100,101],"scoring","pool","wealthville pool scoring","liquidity","which","exit","now","use","when","reduce","with","record","track","verdict","evm","solana","how","public","look",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":109,"publishedAt":43},"01M70MB6VR8ERJ4EM8D5KHBMEV","technical-debt-auditor","Scans a codebase and produces a quantified technical debt report with a prioritized remediation plan. Analyzes dead code, TODO\u002FFIXME\u002FHACK markers, dependency staleness, complexity hotspots, code duplication signals, test coverage gaps, unused exports, and outdated patterns. Use this skill when the user asks to audit their codebase for tech debt, wants a health check of their code quality, says things like \"where should I focus refactoring\", \"find code smells\", \"audit my codebase\", \"what technical debt do we have\", \"prioritize cleanup work\", or asks about code quality metrics. Also trigger when the user mentions \"code rot\", \"legacy cleanup\", \"refactoring priorities\", or wants to understand the overall health of a project before a major effort. Trigger even if the user doesn't say \"technical debt\" explicitly — any request to systematically assess code quality and identify improvement priorities belongs here.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Ftechnical-debt-auditor\u002FSKILL.md",[108],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[110,111,112,113,114,115,116,117,118,119,120,91,121,122,123,124,125,126,127,128],"technical debt","debt","technical","technical debt auditor","auditor","coverage","complexity","markers","project","cleanup","unused","code","todo","work","plan","focus","signals","audit","dependency",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":144,"publishedAt":43},"01M70KPYH9QNHCNME5GJQGE22K","readonly-sql-guard","Make an agent's database access provably read-only. Use when an agent runs caller-supplied SQL against a production\u002FERP\u002Fanalytics database (a \"query\" MCP tool, text-to-SQL, an admin console), or when reviewing DB-access code for write\u002FDDL\u002Fside-effect\u002Ftransaction-escape risks. Checks what a statement CALLS, not just its shape.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdatabase\u002Freadonly-sql-guard\u002FSKILL.md",[135,138,139],{"categoryNo":136,"categoryName":137,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":140,"categoryName":141,"taxonomyType":142,"taxonomyTypeDesc":143},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[145,146,147,148,149,150,151,42,152,153,154,155,156,157,158,90,34,159,91,160],"readonly","guard","sql guard","sql","readonly sql guard","erp","effect","read-only","db","just","tool","calls","only","MCP","database","query",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":165,"licenseFileUrl":166,"sourceHtmlUrl":167,"categories":168,"keywords":172,"publishedAt":43},"01M6AFY6F7CC2BBZP1QD6VTNVC","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[169],{"categoryNo":170,"categoryName":171,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,42,195],"artifacts builder","web","web artifacts builder","artifacts","builder","state","routing","state management","component","css","frontend","ui","Tools","file","components","shadcn","react","Tailwind","suite","jsx","html","single-file","ui components",{"skillNo":197,"name":198,"nameZh":6,"description":199,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":165,"licenseFileUrl":200,"sourceHtmlUrl":201,"categories":202,"keywords":207,"publishedAt":43},"01M6AFWF33SFV9Z3SF4PEEE4BF","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[203,206],{"categoryNo":204,"categoryName":205,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":170,"categoryName":171,"taxonomyType":21,"taxonomyTypeDesc":22},[208,209,210,211,212,174,213,183,184,214,215,216,217,42,218,93,219],"webapp testing","testing","webapp","browser","playwright","applications","debugging","toolkit","logs","screenshots","local","behavior",{"skillNo":221,"name":222,"nameZh":6,"description":223,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":165,"licenseFileUrl":224,"sourceHtmlUrl":225,"categories":226,"keywords":234,"publishedAt":43},"01M6AF67Q67JJJ5V51JR2P52KA","discernment-nudge","After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fdavila7\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fdiscernment-nudge\u002FSKILL.md",[227,230,231],{"categoryNo":228,"categoryName":229,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":232,"categoryName":233,"taxonomyType":142,"taxonomyTypeDesc":143},"01JBSEEDCAT000000000000036","内容创作者",[235,236,237,238,239,240,241,242,176,243,186,121,244,245,246,247,248,157,249,91,250,251,252,253,254,99,255],"discernment nudge","nudge","interpretation","help","run","reasoning","data","writing","lookup","content","review","conversation","short","up","invoke","you","analysis","claims","argument","assemble","recommendations"]