Using NSHTTPCookieStorage
i want to read and set the global cookies also used by Safari for an Associated Domain
linked with the app
However the docu on Associated Domains is quite sparse and i found only docu for the shared credentials https://developer.apple.com/documentation/security/shared_web_credentials
webcredentials:mydomain.com
what i would need is smth like
cookies:mydomain.com
so how to manage cookies for an Associated Domain
?
I don't believe this to be possible using the current API.
Indeed, Radars exist that request this functionality exactly.
From what I've seen in iOS 11, when an application has a domain association and attempts to open an SFSafariViewController
instance, the system asks the user for permission, which if granted, passes the cookies of the domain to the Safari view controller instance. (In iOS 10, Safari view controller shares all cookies with Safari.) This method is used in Facebook and Google apps, among others—they present the Safari view controller to obtain a session token, which they use for subsequent network access.
Edit: It seems the functionality described above is handled by SFAuthenticationSession
. The system prompts the user to allow data sharing, and a Safari view controller is presented with the URL provided. You also provide a URL scheme, which the opened URL must call with the SSO token.