flutter_secure_storage
flutter_secure_storage copied to clipboard
[bug] [macOS]: Asks for confidential information stored in keychain multiple times even after pressing "Always Allow"
This is pretty annoying, to the point where we have to combine all secure information into one key and read/write it only once.
@bvoq Do you know what might be the problem?
Yes, you need to use only one key. I think it prompts the password for each key you use. Luckily Keychain supports 16MB per key.
And use the following options when initialising your keychain:
const MacOsOptions kFlutterSecureStorageMacOSOptions = MacOsOptions(
accessibility: KeychainAccessibility.unlocked_this_device,
groupId: null,
// Note: This needs to be true in order for macOS to only write to the Local Items (or Cloud Items) keychain.
synchronizable: true,
);
See also: https://github.com/mogol/flutter_secure_storage/issues/573
You can debug your application by opening keychain and looking for flutter_secure_storage:
Delete all previous keys there. I noticed that for some reason, if you set synchronizable to false, it writes first to 'Local Items' keychain (or 'iCloud Items' keychain if enabled) and then keeps writing to login keychain instead. With synchronizable: true, the behaviour is more normal. And add the keychain sharing capability to your xcode project.
I am closing all older issues. If this issue still exists in the latest version, please let me know.