Add reset-oauth CLI command to clear cached Apps OAuth tokens#443
Draft
oliverli wants to merge 1 commit into
Draft
Add reset-oauth CLI command to clear cached Apps OAuth tokens#443oliverli wants to merge 1 commit into
reset-oauth CLI command to clear cached Apps OAuth tokens#443oliverli wants to merge 1 commit into
Conversation
Adds `yarn cli reset-oauth` to delete the cached Datadog Apps OAuth token(s) from the OS credential store, so the next upload restarts the browser authorization flow. Defaults to clearing every known site; `--site` targets a single one. Reuses the existing keychain helpers in @dd/core/helpers/oauth-request. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Adds a new internal CLI command,
yarn cli reset-oauth, that clears the cached Datadog Apps OAuth token(s) from the OS credential store so the next upload restarts the browser authorization flow.Previously there was no user-facing way to reset OAuth state — a cached token was only ever deleted automatically when a refresh failed, so resetting meant manually editing the OS keychain.
What it does
yarn cli reset-oauth— clears the cached token for every known Datadog site (SITESfrom@dd/core).yarn cli reset-oauth --site datadoghq.eu— clears the token for a single site; unknown sites are rejected with a clear error.The command reuses the existing
deleteOAuthTokenFromKeychainandgetDatadogOAuthConfighelpers in@dd/core/helpers/oauth-requestrather than reimplementing any keychain logic.Changes
packages/tools/src/commands/reset-oauth/index.ts— the command.packages/tools/src/commands/reset-oauth/index.test.ts— unit tests covering: clear-all, single-site, unknown-site rejection, idempotency, and the failure-path exit code.packages/tools/README.md— documents the new command.Testing
yarn test:unit packages/tools/src/commands/reset-oauth— 5/5 passing.🤖 Generated with Claude Code