Skip to content

feat: send Auth0-Client and User-Agent headers on requests to Auth0 - #153

Merged
kishore7snehil merged 2 commits into
mainfrom
feat/client-telemetry
Nov 5, 2026
Merged

kishore7snehil merged 2 commits into
mainfrom
feat/client-telemetry

Conversation

@kishore7snehil

Copy link
Copy Markdown
Contributor

📋 Changes

This PR makes auth0-api-python send an Auth0-Client header and a User-Agent header on every request it makes to Auth0, so Auth0 can tell which SDK and version a request came from. It also adds a client_info option so a wrapper SDK built on this one can report its own name and version.

✨ Features

  • Auth0-Client Header: A base64 encoded JSON object with name, version and env. The version is read from the installed package, and shows as unknown if the package metadata is not available.
  • Requests Covered: OIDC discovery, JWKS, get_access_token_for_connection(), get_token_by_exchange_profile(), get_token_on_behalf_of() and get_client_credentials_token().
  • Wrapper Identity: ApiClientOptions(client_info={...}) takes a name, a version and an optional env dict. The wrapper is reported as the client, and this SDK's version and the Python version are added to env.

🔧 API Changes

  • Added client_info to ApiClientOptions. A malformed value raises ConfigurationError when the ApiClient is created.
  • Requests to Auth0 now send User-Agent: Python/<version> in place of the httpx default.
  • When a custom_fetch is set, the headers are not added to discovery and JWKS requests, because the caller's function makes those calls.
  • fetch_oidc_metadata() and fetch_jwks() take an optional headers argument, which is not applied when custom_fetch is set.

🧪 Testing

  • This change adds test coverage
  • This change has been tested on the latest version of the platform/language

Contributor Checklist

Adds an Auth0-Client header (base64 JSON of name, version and env) and a User-Agent header to OIDC discovery, JWKS, Token Vault, token exchange, on-behalf-of and client credentials requests. Adds ApiClientOptions.client_info so a wrapper SDK can report its own name, version and env.
@kishore7snehil
kishore7snehil requested a review from a team as a code owner October 29, 2026 14:41
nandan-bhat
nandan-bhat previously approved these changes Nov 3, 2026
…document client_info

Adds a custom_fetch test for discovery and JWKS, asserts the User-Agent
header on every request kind, pins the client_info validation cases and
messages, and stops the telemetry tests depending on the installed package.
Documents client_info and custom_fetch in the docstrings and the README.
@kishore7snehil
kishore7snehil merged commit 607ca43 into main Nov 5, 2026
7 checks passed
@kishore7snehil
kishore7snehil deleted the feat/client-telemetry branch November 5, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants