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.56.3
5,375stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
98/100Excellent
Development Activity100
Maintenance96
Community96
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
88/100Excellent
Architecture90
Code Quality92
Innovation88
Learning Curve78

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 19 apps in this directory

Python
100%
Apache 2.0

Agno

Devops · AI Development · Automation

41,774

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
Python100%
Updated today
Python
49%
Other

Airbyte

Developer Tools · Data Engineering

21,916

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python49%
Kotlin42%
Updated today
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
C++
69%
Apache 2.0

ClickHouse

Databases · Analytics · Data Engineering

49,325

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
C++69%
Python13%
Updated today
Rust
52%
Apache 2.0

cocoindex

Data Engineering · AI Development

11,350

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

View details
87
Repo Health
85
Technical
64
Dependency
Built with
Rust52%
Python48%
Updated yesterday
TypeScript
97%
Other

GrowthBook

Developer Tools · Analytics · Monitoring

8,138

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
66
Dependency
Built with
TypeScript97%
Updated today
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,083

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
62
Repo Health
81
Technical
66
Dependency
Built with
TypeScript91%
Updated 3 days ago
HTML
48%
LGPL-2.1

Horilla

Human Resources · ERP

1,330

Open-source HRMS covering recruitment, attendance, payroll, and biometrics in one self-hosted Django application.

View details
88
Repo Health
60
Technical
65
Dependency
Built with
HTML48%
Python35%
JavaScript13%
Updated today
Python
63%
Other

Keep

Devops · Automation · Monitoring

12,224

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
91
Repo Health
79
Technical
67
Dependency
Built with
Python63%
TypeScript36%
Updated today

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

Search