Are cookies shared between Safari and Webviews?

cookies, safari, webview

Solution

According to the NSHTTPCookieStorage documentation:

Starting in OS X 10.11, each app has its own sharedHTTPCookieStorage singleton, which will not be shared with other applications.

So while the previous answer was correct 3 years ago when it was written, the answer now should be:

1) before OS X 10.11 - Yes they were shared

2) OS X 10.11 and macOS 10.12 - No they are no longer shared.

Problem

According to Apple documentation on NSHTTPCookieStorage The NSHTTPCookieStorage class provides the interface for managing the collection of NSHTTPCookie objects shared by all applications. Therefore, If I'm not mistaken, since a Webview on OS X uses NSHTTPCookieStorage, and Safari uses Webviews, if I login on a given website on a Webview, Safari will use the cookies that has been set by the Webview and when the same website is opened by Safari, it should be authenticated. My question is, if cookies are shared between Safari and Webviews. If so, why the test above is not working ?

Original source

Related problems