Skip to main content

Oauth2clientauth Extension

Status Available in: contrib, k8s Maintainers: @pavankrish123 Source: opentelemetry-collector-contrib

Overview

This extension provides OAuth2 Client Credentials flow authenticator for HTTP and gRPC based exporters. The extension fetches and refreshes the token after expiry automatically. For further details about OAuth2 Client Credentials flow (2-legged workflow) refer https://datatracker.ietf.org/doc/html/rfc6749#section-4.4. The authenticator type has to be set to oauth2client.

Configuration

Following are the configuration fields
  • token_url - The resource server’s token endpoint URLs.
  • client_id - The client identifier issued to the client.
  • grant_type - Optional OAuth2 grant type to use. It can be one of “client_credentials” or “urn:ietf:params:oauth:grant-type:jwt-bearer” and defaults to “client_credentials”
  • client_id_file - The file path to retrieve the client identifier issued to the client. The extension reads this file and updates the client ID used whenever it needs to issue a new token. This enables dynamically changing the client credentials by modifying the file contents when, for example, they need to rotate.
    This setting takes precedence over client_id.
  • client_secret - The secret string associated with above identifier. This is required when grant_type is “client_credentials”
  • client_secret_file - The file path to retrieve the secret string associated with above identifier. The extension reads this file and updates the client secret used whenever it needs to issue a new token. This enables dynamically changing the client credentials by modifying the file contents when, for example, they need to rotate.
    This setting takes precedence over client_secret.
  • client_certificate_key - The private key used to sign the jwt assertion used for RFC7523. This is required when grant_type is “urn:ietf:params:oauth:grant-type:jwt-bearer”
  • client_certificate_key_file - The file path to retrieve the secret string associated with above identifier. The extension reads this file and updates the client key used whenever it needs to issue a new token. This enables dynamically changing the credentials by modifying the file contents when, for example, they need to rotate.
    This setting takes precedence over client_certificate_key.
  • client_certificate_key_id - Optional kid used to sign the jwt assertion used for RFC7523.
  • signature_algorithm - Optional RSA algorithm used to sign jwt assertion used for RFC7523 and defaults to “RS256”.
  • iss - Optional client identifier used added to jwt assertion used for RFC7523 and defaults to “client_id”.
  • audience: - Optional intended audience of the jwt assertion used for RFC7523 and defaults to “token_url”.
  • claims: - Optional extra claims to be added to jwt assertion used for RFC7523.
  • endpoint_params - Additional parameters that are sent to the token endpoint.
  • scopes - Optional optional requested permissions associated for the client.
  • timeout - Optional specifies the timeout on the underlying client to authorization server for fetching the tokens (initial and while refreshing). This is optional and not setting this configuration implies there is no timeout on the client.
  • expiry_buffer - Optional Specifies the time buffer to refresh the access token before it expires, preventing authentication failures due to token expiration. The default value is 5m.
For more information on client side TLS settings, see configtls README.

Configuration

Example Configuration


Last generated: 2026-08-24