mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 01:40:22 +00:00
Fix bug storing credentials in Keychain when there's a previous item.
This commit is contained in:
1 parent
1f893d0197
commit
8f28489d38
1 file changed
+6
@@ -85,8 +85,14 @@ public struct CredentialsManager {
|
||||
throw error
|
||||
}
|
||||
|
||||
// Remove kSecValueData so the delete matches by identity
|
||||
// (server, username, type) regardless of the stored secret.
|
||||
// Without this, the delete fails when the token has changed
|
||||
// (as during an OAuth refresh), and the re-add fails
|
||||
// with errSecDuplicateItem.
|
||||
var deleteQuery = query
|
||||
deleteQuery.removeValue(forKey: kSecAttrAccessible as String)
|
||||
deleteQuery.removeValue(forKey: kSecValueData as String)
|
||||
SecItemDelete(deleteQuery as CFDictionary)
|
||||
|
||||
let addStatus = SecItemAdd(query as CFDictionary, nil)
|
||||
|
||||
Reference in new issue
Block a user