google-auth

The foundational Python library for authenticating to Google Cloud and Google APIs with OAuth2, service accounts, and Application Default Credentials.

Library
PyPI
v2.62.0
5,412 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
98 /100 Excellent
Development Activity 100
Maintenance 96
Community 96
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 90
Code Quality 92
Innovation 88
Learning Curve 78

google-auth is the core authentication library that underpins nearly every Google client library for Python. It centralizes the many server-to-server and user authentication mechanisms Google supports — service account keys, OAuth2 user flows, Application Default Credentials, workload identity federation, impersonation, and Compute Engine/GKE metadata credentials — behind a single, consistent credential abstraction.

Rather than hand-rolling token minting, signing, and refresh logic against Google’s OAuth2 and STS endpoints, applications obtain a Credentials object and attach it to their HTTP or gRPC transport of choice. The library resolves credentials automatically from the environment, refreshes access tokens transparently, and supports advanced scenarios like downscoped tokens, external account (federated) identities, and mutual-TLS authentication.

What You Get

  • A single Credentials abstraction that works across service accounts, OAuth2 user flows, impersonation, and federated identities
  • Application Default Credentials (ADC) resolution that auto-discovers credentials from env vars, gcloud config, and the metadata server
  • Pluggable transport integrations for requests, urllib3, aiohttp, and gRPC, including async credential support
  • Automatic access-token refresh, JWT minting/signing, mutual-TLS (mTLS) support, and workload identity federation for keyless auth

Common Use Cases

  • Authenticating Google Cloud client libraries (Storage, BigQuery, Pub/Sub) without managing tokens manually
  • Running workloads on GCE, GKE, or Cloud Run that authenticate via the metadata server with zero embedded secrets
  • Federating identities from AWS, Azure, or an OIDC provider into Google Cloud using workload identity federation
  • Impersonating a service account or issuing downscoped, least-privilege tokens for delegated access

Under The Hood

Architecture — The library centers on an abstract Credentials base (google/auth/credentials.py) that every concrete credential type subclasses: oauth2/service_account.py, oauth2/credentials.py (user OAuth2), compute_engine, impersonated_credentials.py, external_account.py, identity_pool.py, aws.py, and api_key.py. Callers rarely instantiate these directly — google/auth/_default.py implements Application Default Credentials, probing environment variables, the gcloud config file (_cloud_sdk.py), and the GCE metadata server in order to resolve a credential. Each credential exposes a refresh(request) method that mints or renews a token against Google’s OAuth2/STS endpoints (oauth2/_client.py, oauth2/sts.py); a _refresh_worker.py enables proactive background renewal. Transport-specific AuthorizedSession/interceptor adapters live under google/auth/transport/ and attach the credential’s token to outgoing HTTP or gRPC calls.

Tech Stack — Pure Python (>=3.10) with a deliberately lean required dependency set: cryptography and pyasn1-modules for signing and ASN.1 parsing. Transport and feature integrations are gated behind extras (requests, aiohttp, urllib3, grpc, pyjwt, reauth, rsa, enterprise_cert) so applications pull in only what they use. Async support is a parallel implementation under google/auth/aio/ and oauth2/_client_async.py. Packaging is classic setup.py with namespace packages and a shipped py.typed marker; tooling includes nox, flake8, mypy, and coverage.

Code Quality — Maturity is high: 69 test modules across tests/ and tests_async/, a py.typed marker signalling full type coverage, and mypy/flake8 configs enforced via noxfile.py. Credential types share a consistent refresh/apply/before_request contract, errors are funneled through a dedicated exceptions.py hierarchy (RefreshError, DefaultCredentialsError, TransportError), and internal helpers are clearly namespaced with leading underscores. A 140KB CHANGELOG and Production/Stable classifier reflect long-term, disciplined maintenance.

API Design — The public surface is small and ergonomic: google.auth.default() returns credentials plus a project id in one call, and __all__ intentionally exposes only default, load_credentials_from_file, and load_credentials_from_dict. The polymorphic Credentials contract means downstream client libraries stay transport- and credential-agnostic, and the requests/gRPC adapters reduce wiring to a couple of lines. The main friction is conceptual rather than API-level — the breadth of credential types (ADC, federation, impersonation, downscoping) demands reading the docs to pick the right one — but everyday usage requires almost no boilerplate.

Used by 151 apps in this directory

Rust
53%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,746

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
86
Repo Health
85
Technical
65
Dependency
Built with
Rust 53%
Python 47%
Updated 6 days ago
Rust
53%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,746

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
86
Repo Health
85
Technical
65
Dependency
Built with
Rust 53%
Python 47%
Updated 6 days ago
HTML
84%
Apache 2.0

Elementary

Analytics · Data Engineering · Monitoring

2,428

The dbt-native data observability CLI that turns your existing dbt tests and metadata into anomaly detection, lineage graphs, and Slack/Teams alerts — no separate platform required.

View details
88
Repo Health
75
Technical
75
Dependency
Built with
HTML 84%
Python 16%
Updated 1 weeks ago
Python
66%
MIT

Flowfile

Data Engineering

398

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python 66%
TypeScript 17%
Vue 16%
Updated 6 days ago
Python
66%
MIT

Flowfile

Data Engineering

398

Visual ETL that compiles to Polars — build pipelines on a canvas, export as standalone Python, and run anywhere without platform lock-in.

View details
83
Repo Health
81
Technical
66
Dependency
Built with
Python 66%
TypeScript 17%
Vue 16%
Updated 6 days ago
Python
83%
MIT

Gemma Multimodal Fine-Tuner

AI Development

1,516

An Apple-Silicon-native LoRA fine-tuning tool for Gemma on text, image, and audio data — with a wizard CLI, live browser-based training visualizer, and streaming from GCS/BigQuery for datasets too large for local disk.

View details
60
Repo Health
68
Technical
72
Dependency
Built with
Python 83%
Updated 3 weeks ago
TypeScript
98%
Other

GrowthBook

Ab Testing Experimentation · Analytics · Developer Tools

8,527

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
63
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
91%
Apache 2.0

Helicone

AI Development · Analytics · Monitoring

6,235

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
74
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 91%
Updated 5 days ago
TypeScript
91%
Apache 2.0

Helicone

AI Development · Analytics · Monitoring

6,235

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
74
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 91%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers