Skip to content

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

Merged
steipete merged 1 commit intosteipete:mainfrom
mvanhorn:osc/466-auth-remove-config-cleanup
Apr 20, 2026
Merged

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

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

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) <noreply@anthropic.com>
@steipete steipete merged commit 52c4a30 into steipete:main Apr 20, 2026
1 check passed
@steipete
Copy link
Copy Markdown
Owner

Landed on main.

  • Local gate: make ci
  • CI: run 24666775462 green
  • Merge commit: 52c4a30
  • Final main after changelog/lint cleanup: 4247608

Thanks @mvanhorn!

@mvanhorn
Copy link
Copy Markdown
Contributor Author

Thanks @steipete! Glad the gate was clean.

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

2 participants