Skip to content

feat: add auth credentials remove command#473

Merged
steipete merged 4 commits intosteipete:mainfrom
yamagucci:feat/credentials-delete
Apr 20, 2026
Merged

feat: add auth credentials remove command#473
steipete merged 4 commits intosteipete:mainfrom
yamagucci:feat/credentials-delete

Conversation

@yamagucci
Copy link
Copy Markdown
Contributor

@yamagucci yamagucci commented Mar 24, 2026

Summary

  • Add gog auth credentials remove subcommand to remove stored OAuth client credentials
  • Previously only set and list were available — there was no way to remove credentials via the CLI
  • Also removes associated refresh tokens for all accounts authenticated under the deleted client
  • Cleans up domain mappings (--domain) that reference the removed client

Usage

# Remove default client credentials (+ its tokens)
gog auth credentials remove

# Remove a named client
gog auth credentials remove work

# Remove all stored credentials
gog auth credentials remove all

# Preview what would be removed
gog auth credentials remove --dry-run

# Skip confirmation prompt
gog auth credentials remove --force

Confirmation prompt example

Proceed to remove OAuth credentials for client "work" and 2 associated token(s) (alice@co.com, bob@co.com)? [y/N]:

Implementation

  • config.DeleteClientCredentialsFor(client) — removes the credentials JSON file
  • AuthCredentialsRemoveCmd — CLI command following the same patterns as auth remove
    • Accepts optional positional [<client>] argument
    • Supports all to remove every stored credential
    • Falls back to --client flag or default when no arg is given
    • Finds and deletes all tokens stored under the target client
    • Cleans up domain mappings referencing the deleted client
    • Confirmation prompt shows affected accounts, --dry-run, --force, --json output

Test plan

  • go build ./... passes
  • go test ./internal/config/... ./internal/cmd/... passes
  • gog auth credentials remove --help shows correct usage
  • Manual test: set + add accounts + remove + list cycle

🤖 Generated with Claude Code

@yamagucci yamagucci changed the title feat: add auth credentials delete command feat: add auth credentials remove command Mar 24, 2026
yamagucci and others added 4 commits April 20, 2026 16:23
Add a new subcommand to delete stored OAuth client credentials.
Previously there was no way to remove credentials via the CLI —
only `set` and `list` were available.

The command:
- Deletes the credentials file for the specified client (or default)
- Cleans up any domain mappings that reference the deleted client
- Supports --dry-run, --force, --json flags (consistent with other destructive commands)
- Prompts for confirmation before deletion

Usage:
  gog auth credentials delete              # delete default client
  gog --client work auth credentials delete # delete named client

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rename `delete` to `remove` for consistency with `auth remove`
- Accept optional client name as positional argument
  (e.g. `gog auth credentials remove work`)
- Support `all` to remove every stored credential at once
- Falls back to --client flag or default when no arg is given

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When removing OAuth client credentials, find and delete all refresh
tokens stored under that client. The confirmation prompt now shows
which accounts will be affected (e.g. "remove OAuth credentials for
client "work" and 2 associated token(s) (alice@co.com, bob@co.com)").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: takashiyamaguchi <yama0628taka@gmail.com>
@steipete steipete force-pushed the feat/credentials-delete branch from 5024820 to d6f8589 Compare April 20, 2026 15:31
@steipete steipete merged commit c73bb23 into steipete:main Apr 20, 2026
1 check passed
@steipete
Copy link
Copy Markdown
Owner

Landed in c73bb23 after a polish pass.

Changes added while landing:

  • propagated credentials/config/keyring errors instead of swallowing them
  • added dry-run JSON behavior for remove/remove-all
  • removed associated tokens and domain mappings deterministically
  • added regression coverage and README/spec/CHANGELOG entries

Verified locally with make fmt, make lint, make test, make build, and make ci.

Thanks again @yamagucci.

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