Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Sebaiknya akses Secret Manager API menggunakan alat berikut:
Google Cloud CLI, yang menyediakan antarmuka command line untuk mengelola secret.
Library klien Secret Manager yang praktis dan idiomatis, yang memungkinkan Anda mengakses dan mengelola secret dari dalam kode sumber aplikasi. Library klien tersedia dalam banyak bahasa, termasuk C#(.NET), Go, Java, Node.js, PHP, Python, dan Ruby.
Menggunakan Secret Manager dengan Compute Engine dan Google Kubernetes Engine
Untuk menggunakan Secret Manager dengan workload yang berjalan di Compute Engine atau GKE, instance atau node yang mendasarinya harus memiliki cakupan OAuth cloud-platform. Jika Anda menerima error dengan pesan
berikut, artinya instance atau node tidak disediakan dengan cakupan
OAuth yang benar.
Request had insufficient authentication scopes
Cakupan OAuth yang diperlukan untuk menggunakan Secret Manager adalah:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 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)."]]