Description
id == <!--- @begin-badges@ --->  [](https://pypi.org/project/id) [](https://api.securityscorecards.dev/projects/github.com/di/id) [](https://slsa.dev/) <!--- @end-badges@ ---> `id` is a Python tool for generating OIDC identities. It can automatically detect and produce OIDC credentials on a number of environments, including GitHub Actions, GitLab pipelines and Google Cloud. ## Installation `id` requires Python 3.8 or newer, and can be installed directly via `pip`: ```console python -m pip install id ``` ## Usage You can run `id` as a Python module via `python -m`: ```console python -m id --help ``` Top-level: <!-- @begin-id-help@ --> ``` usage: id [-h] [-V] [-v] [-d] audience a tool for generating OIDC identities positional arguments: audience the OIDC audience to use optional arguments: -h, --help show this help message and exit -V, --version show program's version number and exit -v, --verbose run with additional debug logging; supply multiple times to increase verbosity (default: 0) -d, --decode decode the OIDC token into JSON (default: False) ``` <!-- @end-id-help@ --> For Python API usage, there is a single importable function, `detect_credential`: ```pycon >>> from id import detect_credential >>> detect_credential(audience='something') '<OIDC token>' ``` This function requires an `audience` parameter, which is used when generating the OIDC token. This should be set to the intended audience for the token. If no supported environment is found, `detect_credential` returns `None`. If a supported environment is found but `detect_credential` fails to retrieve a token, it raises `AmbientCredentialError`. ## Supported environments `id` currently supports ambient credential detection in the following environments: * [GitHub Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) * Google Cloud * [Cloud Run](https://cloud.google.com/run/docs/securing/service-identity) * [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) * [Compute Engine](https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances) * and more * [Buildkite](https://buildkite.com/docs/agent/v3/cli-oidc) * [GitLab](https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html) (See _environment variables_ below) * [CircleCI](https://circleci.com/docs/oidc-tokens-with-custom-claims/) ### Tokens in environment variables GitLab provides OIDC tokens through environment variables. The variable name must be `<AUD>_ID_TOKEN` where `<AUD>` is the uppercased audience argument where all characters outside of ASCII letters and digits are replaced with "\_". A leading digit must also be replaced with a "\_". ## Licensing `id` is licensed under the Apache 2.0 License. ## Contributing See [the contributing docs](https://github.com/di/id/blob/main/CONTRIBUTING.md) for details. ### SLSA Provenance This project emits a SLSA provenance on its release! This enables you to verify the integrity of the downloaded artifacts and ensured that the binary's code really comes from this source code. To do so, please follow the instructions [here](https://github.com/slsa-framework/slsa-github-generator#verify-provenance).
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 1.6.1 | Imported from PyPI (1.6.1) | Low | 4/21/2026 |
| v1.6.1 | ## What's Changed * Audience fixes by @jku in https://github.com/di/id/pull/443 **Full Changelog**: https://github.com/di/id/compare/v1.6.0...v1.6.1 | Low | 2/4/2026 |
| v1.6.0 | ## What's Changed * Add PyPy to testing strategy by @di in https://github.com/di/id/pull/340 * refactor: replace requests with urllib3 by @woodruffw in https://github.com/di/id/pull/333 * chore: mark Python 3.14 support, drop 3.8 by @woodruffw in https://github.com/di/id/pull/433 * add support for --root-issuer when generating CCI claims by @meeech in https://github.com/di/id/pull/438 * prep 1.6.0 release by @di in https://github.com/di/id/pull/440 ## New Contributors * @webknjaz made t | Low | 1/30/2026 |
| v1.5.0 | ### Changed * Drop dependency on `pydantic` ([#320](https://github.com/di/id/pull/320)) | Low | 12/4/2024 |
| v1.4.0 | ### Added * Add `pipx run` entry point ([#217](https://github.com/di/id/pull/217)) | Low | 4/24/2024 |
| v1.3.0 | ## What's Changed * Miscellaneous cleanup by @woodruffw in https://github.com/di/id/pull/149 * Add `-d`/`--decode` flag to decode the JWT by @di in https://github.com/di/id/pull/162 * Version 1.3.0 by @di in https://github.com/di/id/pull/163 **Full Changelog**: https://github.com/di/id/compare/v1.2.1...v1.3.0 | Low | 1/11/2024 |
| v1.2.1 | ### Misc * This release fixes a deployment bug in the 1.2.0 release. | Low | 12/12/2023 |
| v1.2.1rc1 | Release v1.2.1rc1 | Low | 12/12/2023 |
| v1.2.0 | ### Added * Added support for GitLab CI/CD ([#123](https://github.com/di/id/pull/123)) * Added support for CircleCI ([#144](https://github.com/di/id/pull/144)) ### Changed * The minimum supported Python version is now 3.8 ([#141](https://github.com/di/id/pull/141)) | Low | 12/12/2023 |
| v1.1.0 | ### Added * Added support for Buildkite OIDC tokens ([#21](https://github.com/di/id/pull/21)) ### Fixed * Improved the quality of error messages when an underlying request fails ([#93](https://github.com/di/id/pull/93)) | Low | 8/26/2023 |
| v1.0.0 | ## What's Changed * Release: 1.0.0 by @woodruffw in https://github.com/di/id/pull/19 * Update README.md by @di in https://github.com/di/id/pull/20 **Full Changelog**: https://github.com/di/id/compare/v1.0.0a2...v1.0.0 | Low | 3/6/2023 |
| v1.0.0a2 | ## What's Changed * RC: 1.0.0a2 by @woodruffw in https://github.com/di/id/pull/18 **Full Changelog**: https://github.com/di/id/compare/v1.0.0a1...v1.0.0a2 | Low | 3/6/2023 |
| v1.0.0a1 | ## What's Changed * workflows/release: use GH action for signing by @woodruffw in https://github.com/di/id/pull/16 * id: 1.0.0a1 by @woodruffw in https://github.com/di/id/pull/17 **Full Changelog**: https://github.com/di/id/compare/v1.0.0a0...v1.0.0a1 | Low | 3/6/2023 |
| v1.0.0a0 | ## What's Changed * Initial split from `sigstore-python` by @di in https://github.com/di/id/pull/4 * Remove author metadata by @di in https://github.com/di/id/pull/5 * Update ruff requirement from <0.0.224 to <0.0.253 by @dependabot in https://github.com/di/id/pull/8 * Bump slsa-framework/slsa-github-generator from 1.2.1 to 1.4.0 by @dependabot in https://github.com/di/id/pull/7 * Bump github/codeql-action from 2.1.38 to 2.2.4 by @dependabot in https://github.com/di/id/pull/6 * Bump slsa-f | Low | 3/6/2023 |
