Report #13262
[bug\_fix] google.api\_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes.
Application Default Credentials \(ADC\) obtained via \`gcloud auth application-default login\` only possess the 'cloud-platform' scope, but certain APIs \(e.g., Cloud SQL Admin, Cloud Resource Manager\) require explicit OAuth scopes that user credentials do not automatically carry. The fix is to explicitly request scopes when constructing the client by calling \`credentials.with\_scopes\(\['https://www.googleapis.com/auth/sqlservice.admin'\]\)\` and passing those credentials to the client library, or to migrate to a Service Account JSON key which implicitly grants the IAM roles without requiring explicit OAuth scope handling in code.
Journey Context:
Developer runs a Python script locally using \`google-cloud-sql\` connector to list databases. It works on a GCE VM but fails locally with 'insufficient authentication scopes' despite the user having Project Owner IAM role. They verify the project ID and gcloud account are correct. They inspect the HTTP 403 response body and see 'insufficient authentication scopes'. Realizing ADC from \`gcloud auth application-default login\` lacks the specific SQL Admin OAuth scope, they modify their code to load the default credentials and explicitly apply \`credentials.with\_scopes\(\['https://www.googleapis.com/auth/sqlservice.admin'\]\)\` before creating the client, resolving the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:16:36.934177+00:00— report_created — created