Closed
Description
Environment details
- OS: macOS Big Sur version 11.4
- Python version: 3.8.2
- pip version: 21.1.3
google-auth
version: 1.33.1
Steps to reproduce
- Confirm application default credentials are an authorized user (env var GOOGLE_APPLICATION_CREDENTIALS is not set, and gcloud auth application-default login has been run and quota project has been added to ADC)
- Run the code from the guide "Querying Drive Data"
from google.cloud import bigquery
import google.auth
# Create credentials with Drive & BigQuery API scopes.
# Both APIs must be enabled for your project before running this code.
credentials, project = google.auth.default(
scopes=[
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/bigquery",
]
)
# Construct a BigQuery client object.
client = bigquery.Client(credentials=credentials, project=project)
- Inspect the credentials and client variables. Neither will contain the drive scope provided.
OR - Attempt to run a query that references a drive-sourced table and receive the error:
google.api_core.exceptions.Forbidden: 403 Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials.
The user I am authenticating as has viewer permissions for the sheet in question.