How To Suppress Python Error ‘google.api_core.exceptions.Forbidden: 403 GET https://bigquery.googleapis.com/bigquery/v2/projects/: Request had insufficient authentication scopes.’

Vibhor Gupta
1 min readJun 26, 2020

We get this error ‘google.api_core.exceptions.Forbidden: 403 GET https://bigquery.googleapis.com/bigquery/v2/projects/XXXXX/queries/XXXXXXXX?maxResults=0&location=XX: Request had insufficient authentication scopes.’ when we are trying to operate BigQuery table though Python Code.

Solution: To solve this error we need to perform following steps :

  1. Download GCP Service account file with required privileges.
  2. Set following parameters in your python code

Import os
#Replace with service account path
path_service_account = ‘XXXXXXXXX.json’
os.environ[“GOOGLE_APPLICATION_CREDENTIALS”] = path_service_account

--

--

Vibhor Gupta

Hi, I am a Certified Google Cloud Data engineer. I use Medium platform to share my experience with other members of Medium network.