Skip to content

feat: add auth credentials remove command#473

Open
yamagucci wants to merge 3 commits intosteipete:mainfrom
yamagucci:feat/credentials-delete
Open

feat: add auth credentials remove command#473
yamagucci wants to merge 3 commits intosteipete:mainfrom
yamagucci:feat/credentials-delete

Conversation

@yamagucci
Copy link

@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) ([email protected], [email protected])? [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 and others added 2 commits March 25, 2026 04:03
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) <[email protected]>
- 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) <[email protected]>
@yamagucci yamagucci changed the title feat: add auth credentials delete command feat: add auth credentials remove command Mar 24, 2026
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) ([email protected], [email protected])").

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.

1 participant