fix(login): delete OAuth token using the stored login name

- Pass the stored login name to DeleteOAuthToken instead of the
  CLI-provided one: the login lookup is case-insensitive but credstore
  keys are exact-match, so deleting with different casing left the
  encrypted token orphaned in the credential store

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bo-Yi Wu
2026-08-03 21:59:44 +08:00
parent f6d939a8df
commit b645a189a2
+4 -1
View File
@@ -240,11 +240,14 @@ func DeleteLogin(name string) error {
}
isOAuth := config.Logins[idx].IsOAuth()
// Use the stored login name, not the CLI-provided one: the lookup above
// is case-insensitive, but credstore keys are exact-match.
storedName := config.Logins[idx].Name
config.Logins = append(config.Logins[:idx], config.Logins[idx+1:]...)
// Clean up credstore tokens for OAuth logins
if isOAuth {
_ = DeleteOAuthToken(name)
_ = DeleteOAuthToken(storedName)
}
return saveConfigUnsafe()