Stay organized with collections
Save and categorize content based on your preferences.
We recommend that you access Secret Manager API using the following tools:
The Google Cloud CLI, which provides a
command-line interface for managing secrets.
Convenient, idiomatic Secret Manager client libraries, which lets you access and manage
secrets from within your application source code. Client libraries are available
in many languages including C#(.NET), Go, Java, Node.js, PHP, Python, and Ruby.
Use Secret Manager with Compute Engine and Google Kubernetes Engine
To use Secret Manager with workloads running on Compute Engine
or GKE, the underlying instance or node must have the
cloud-platform OAuth scope. If you receive an error with the following
message, it means the instance or node was not provisioned with the correct
OAuth scopes.
Request had insufficient authentication scopes
The required OAuth scope to use Secret Manager is:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[],[],null,["# Access the Secret Manager API\n\nWe recommend that you access Secret Manager API using the following tools:\n\n- The [Google Cloud CLI](/sdk/gcloud/reference/secrets), which provides a\n command-line interface for managing secrets.\n\n- Convenient, idiomatic [Secret Manager client libraries](/secret-manager/docs/reference/libraries), which lets you access and manage\n secrets from within your application source code. Client libraries are available\n in many languages including C#(.NET), Go, Java, Node.js, PHP, Python, and Ruby.\n\nBefore you begin\n----------------\n\n1. [Enable the Secret Manager API](/secret-manager/docs/configuring-secret-manager).\n\n2. Requests to the Secret Manager API require authentication. For\n information, see\n [Set up authentication for Secret Manager](/secret-manager/docs/authentication#authn-how-to).\n\nUse Secret Manager with Compute Engine and Google Kubernetes Engine\n-------------------------------------------------------------------\n\nTo use Secret Manager with workloads running on Compute Engine\nor GKE, the underlying instance or node must have the\n`cloud-platform` OAuth scope. If you receive an error with the following\nmessage, it means the instance or node was not provisioned with the correct\nOAuth scopes. \n\n Request had insufficient authentication scopes\n\nThe required OAuth scope to use Secret Manager is: \n\n https://www.googleapis.com/auth/cloud-platform\n\nWhen creating a new instance, instance group, or node pool,\n[specify the `cloud-platform` scope](/compute/docs/access/create-enable-service-accounts-for-instances#using): \n\n### gcloud\n\n gcloud compute instances create \"\u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e\" \\\n --scopes \"https://www.googleapis.com/auth/cloud-platform\"\n\nFor an existing instance, instance group, or node pool,\n[update the access scopes](/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes): \n\n### gcloud\n\n gcloud compute instances set-service-account \"\u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e\" \\\n --service-account \"\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL\u003c/var\u003e\" \\\n --scopes \"https://www.googleapis.com/auth/cloud-platform\"\n\nSee the\n[Compute Engine service account permissions](/compute/docs/access/service-accounts#service_account_permissions)\nfor more information.\n\nUse Secret Manager with App Engine\n----------------------------------\n\nTo use Secret Manager with workloads running on App Engine, you must\ngrant any [required permissions](/secret-manager/docs/access-control#roles) to the\nApp Engine service.\n\nWhat's next\n-----------\n\n- Learn more about [managing access to Secret Manager resources with IAM](/secret-manager/docs/access-control).\n- Learn how to [create a secret and access a secret version](/secret-manager/docs/create-secret-quickstart)."]]