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

Python
87%
Apache 2.0

Apache Airflow

Data Engineering

47,268

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
64
Dependency
Built with
Python 87%
Updated 5 days ago
Python
87%
Apache 2.0

Apache Airflow

Data Engineering

47,268

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
64
Dependency
Built with
Python 87%
Updated 5 days ago
Python
87%
Apache 2.0

Apache Airflow

Data Engineering

47,268

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
64
Dependency
Built with
Python 87%
Updated 5 days ago
Python
68%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,722

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 68%
TypeScript 30%
Updated 5 days ago
Python
68%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,722

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 68%
TypeScript 30%
Updated 5 days ago
Python
68%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,722

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 68%
TypeScript 30%
Updated 5 days ago
TypeScript
40%
AGPL 3.0

BrowserOS

AI Assistants · Browser

14,082

The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.

View details
87
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 40%
Rust 34%
Python 16%
Updated 5 days ago
Python
84%
MIT

CertMate

Devops · Security

1,477

Automate SSL certificate lifecycle across any CA, 24+ DNS providers, and every major secret store — with a REST API, web dashboard, and built-in MCP server for AI-driven ops.

View details
83
Repo Health
84
Technical
70
Dependency
Built with
Python 84%
Updated 6 days ago
C++
68%
Apache 2.0

ClickHouse

Analytics · Data Engineering · Databases

50,569

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
65
Dependency
Built with
C++ 68%
Python 13%
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