Remove OAuth from the dev server and use DD_OAUTH_ACCESS_TOKEN passed by the apps CLI - #495
Closed
Conversation
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
oliverli
deleted the
oliverli/remove-oauth-from-dev-server-take-dd_oauth_access_token-instead
branch
September 2, 2026 19:33
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.

Summary
Implements the dev-server section of the RFC "OAuth multi org credential management in apps CLI" (Confluence: RFC OAuth multi org credential management in apps CLI → Integration with the Vite build plugin's dev server).
@datadog/apps-clinow owns the OAuth flow: login, token storage, org selection, and refresh. The CLI passes the access token to the dev server viaDD_OAUTH_ACCESS_TOKENwhen it spawns it throughdatadog-apps dev. The plugin no longer duplicates any OAuth/session logic.Changes
Authentication precedence (
auth.ts):getAuthenticatedRequest()reads credentials from the environment in this order:DD_API_KEY/DATADOG_API_KEY+DD_APP_KEY/DATADOG_APP_KEY→ API-key authDD_OAUTH_ACCESS_TOKEN/DATADOG_OAUTH_ACCESS_TOKEN→ Bearer authMissingAuthenticationErrorwith guidance to start the dev server withdatadog-apps devRemoved:
apps.authOverridesoption, theAuthMethodtype, and auth-method resolution invalidate.ts.DD_APPS_AUTH_METHOD/DATADOG_APPS_AUTH_METHODenv vars.doOAuthRequestdependency from the dev-server path (browser auth, keychain storage, token refresh all live in the CLI now).Added:
OAUTH_ACCESS_TOKENto the coreOVERRIDE_VARIABLESregistry (bothDD_andDATADOG_prefixes).datadog-apps devflow.Notes for reviewers
/__dd/executeActionrequests return 400 with the same guidance.setupAfterEnvrunscleanEnv()after collection, sodev-server.test.tscaptures the authenticated request at collection time and the bearer test pins its token in the test body. All tests pass individually and in any order.Verification
authOverrides,AuthMethod, orAPPS_AUTH_METHOD.