'Keychain access control from the app with different names

I am using keychain in my macOS app to store jwt tokens (access and refresh)(kSecClassGenericPassword) and I have figure out that I can't manage existed data via the same app with another name. I have build two equal application with different app names:

for example: App1.app and App2.app Note: it's the same build, but with only different - app file name.

And if I created the keychain item using the first app (App1.app) I can't remove it from the second one.

If I double click on keychain item in Keychain Access default App I can see that there is only one app in Access Control tab (with the name App1.app).

Is there a way to give the access to keychain ignoring app names. Because user can change the name, or make a duplicate of the app.

Is there a solution of this behaviour?

Thank you!



Solution 1:[1]

So to solve it I set Keychain Sharing Capability and set (for macOS It's very necessary!) kSecAttrSynchronizable or/and kSecUseDataProtectionKeychain

More info here: https://medium.com/@bhojwaniravi/making-mac-oskeychain-behave-as-ios-keychain-60eedb37c173

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tony