CRED-2148: Add PAT auth support to TypeScript API client#3588
Open
CRED-2148: Add PAT auth support to TypeScript API client#3588
Conversation
This was referenced Mar 4, 2026
d96f349 to
e98992e
Compare
ea09b2b to
d14ed67
Compare
2d798e4 to
ed16242
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Add support for Personal Access Token (PAT) authentication via the
Authorization: Bearer <PAT>header. The OpenAPI spec now definesbearerAuthas a security scheme withx-env-name: DD_BEARER_TOKEN, and this aligns the TypeScript client with that spec.Behavior
When
DD_BEARER_TOKENis set, theAuthorization: Bearerheader is sent alongside any configured API key and app key headers. Auth methods are NOT mutually exclusive — all configured headers are sent, and the server uses whichever is valid.DD_API_KEYset ->DD-API-KEYheader sentDD_APP_KEYset ->DD-APPLICATION-KEYheader sentDD_BEARER_TOKENset ->Authorization: Bearer <token>header sentSummary
packages/datadog-api-client-common/auth.ts: AddedBearerAuthAuthenticationclass that setsAuthorization: Bearer <token>header. AddedbearerAuthtoAuthMethodsandAuthMethodsConfigurationtypes, andconfigureAuthMethods().packages/datadog-api-client-common/configuration.ts: AddedDD_BEARER_TOKENenv var support increateConfiguration(). Bearer auth is applied inapplySecurityAuthentication()alongside (not instead of) API key and app key auth.packages/datadog-api-client-common/http/isomorphic-fetch.ts: Added redaction ofAuthorizationheader in debug logging, matching the existing pattern forDD-API-KEYandDD-APPLICATION-KEY.tests/api/auth.test.ts: 10 unit tests covering bearer header application,configureAuthMethods,createConfigurationwithDD_BEARER_TOKENenv var, and combined auth header behavior.Test plan
npx jest tests/api/auth.test.ts)Authorization: BearerheaderbearerAuthscheme,DD_BEARER_TOKENenv varGenerated with Claude Code
PR Stack
API Client Libraries
OpenAPI Spec Changes