Report #76395
[bug\_fix] Google Cloud API returns HTTP 403 Permission denied with detail \\"Request had insufficient authentication scopes\\" when calling Cloud Storage or Compute APIs from a GCE VM
Stop the GCE VM, edit its access scopes to include the necessary OAuth scope \(e.g., https://www.googleapis.com/auth/cloud-platform for full access, or specific scopes like https://www.googleapis.com/auth/devstorage.read\_write\), then restart the VM. Root cause: Even if the VM's service account has broad IAM permissions \(e.g., roles/storage.admin\), the VM instance must have OAuth access scopes enabled that authorize the instance to request access tokens for those specific APIs. The metadata server returns access tokens whose OAuth scopes are the intersection of the IAM permissions and the VM's access scopes; without the scope, the token lacks the necessary claim.
Journey Context:
Developer creates a GCE VM using the default compute service account, which has been granted the \\"Storage Admin\\" IAM role at the project level. They SSH into the VM and run a Python script using google-cloud-storage to list buckets. It fails with a 403 error and the message \\"Request had insufficient authentication scopes\\". The developer verifies IAM permissions by running \`gcloud projects get-iam-policy\` and confirms the service account has the correct role. They try \`gcloud auth list\` on the VM and see the active account is the correct service account. They check the application code \(it's correct\). They then examine the VM instance details in the Cloud Console and notice under \\"Cloud API access scopes\\" it shows \\"Allow default access\\" which only includes Compute and Logging, not Storage. They stop the VM, edit the VM to change the scope to \\"Allow full access to all Cloud APIs\\", start the VM, and the script immediately works because the metadata server now provides an access token with the storage OAuth scope.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:49:00.198576+00:00— report_created — created