Skip to content

fix(auth): clean up config.json entries on auth remove#467

Open
mvanhorn wants to merge 1 commit intosteipete:mainfrom
mvanhorn:osc/466-auth-remove-config-cleanup
Open

fix(auth): clean up config.json entries on auth remove#467
mvanhorn wants to merge 1 commit intosteipete:mainfrom
mvanhorn:osc/466-auth-remove-config-cleanup

Conversation

@mvanhorn
Copy link

Summary

gog auth remove now cleans up account_aliases and account_clients entries in config.json when removing an account. Previously only the keyring token was deleted, leaving stale references.

Changes

In internal/cmd/auth_accounts.go, added a config.UpdateConfig() call after store.DeleteToken() that:

  • Removes alias entries where the value matches the removed email
  • Removes the account client entry for the removed email
  • Intentionally does NOT remove credentials.json (shared across accounts)

Testing

Added test in auth_cmd_test.go verifying config cleanup after auth remove.
Existing auth tests pass.

Fixes #466

This contribution was developed with AI assistance (Claude Code).

When running `gog auth remove`, stale account_aliases and
account_clients entries were left in config.json after the keyring
token was deleted. This adds a config.UpdateConfig() call that removes
alias entries pointing to the removed email and the account_clients
entry for that email.

Fixes steipete#466

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.

gog auth remove does not clean up config.json entries

1 participant