shared HTTPCookieStorage flushing , session cookies

After a few experiments with HTTPCookieStorage.sharedCookieStorage , it seems that the behavior for the storage in that scenario involves some kind of OS flushing / synchronisation:

There seem to be cases when the storage is updated, yet the updates aren't visible. Examples are: update by a process not visible by other processes from the same app group, hard crash / killing, etc.

This all led me believe that there is some caching involved (of course, i can only guess, as the documentation provides 0 clues on internals).

In some cases, such as authentication session cookies, this could have disastreous consequences (such as login out a user for no reason).

=> Is there some kind of way to force the flushing on the cookies, for the important ones ? Are there recommended alternatives for storing authentication cookies shared accross apps and extensions (keychain ?)

Are there recommended alternatives for storing authentication cookies shared accross apps and extensions (keychain ?)

Yes, you could try using a token based authentication scheme that is saved in an account Keychain instead. To see how to delegate account credentials in the Keychain to handle this, checkout the article on Adding a Password to the Keychain.. This is also PassKeys for your iOS 16 requirements.

shared HTTPCookieStorage flushing , session cookies
 
 
Q