Nick's Blog

how to resolve error google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials

The following errors are the ones I was getting when I worked with Google SDK – Python.

google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started

The above error happens when you have not configure your google authentication. The easiest way is just setup GOOGLE_APPLICATION_CREDENTIALS

export GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/key.json

After you have set up the environment variable. This should fix the authentication issue.