pydata-google-auth wraps the google-auth and google-auth-oauthlib libraries to make it easier to get and cache user credentials for accessing the Google APIs from locally-installed data tools and libraries.


To use this module, you will need a Google account and developer project. Follow the Using the BigQuery sandbox instructions to get started with big data on Google Cloud without a credit card.

See the Google Cloud Platform authentication guide for best practices on authentication in production server contexts.

User credentials

Use the pydata_google_auth.get_user_credentials() to get user credentials, authenticated to Google APIs.

Default credentials

Data library and tool authors can use the pydata_google_auth.default() function to get Application Default Credentials and fallback to user credentials when no valid Application Default Credentials are found.

When wrapping the pydata_google_auth.default() method for use in your tool or library, please provide your own client ID and client secret. Enable the APIs your users will need in the project which owns the client ID and secrets. Note that some APIs, such as Cloud Vision, bill the client project. Verify that the API you are enabling bills the user’s project not the client project.