[Webkit-unassigned] [Bug 198554] New: Unable to get cookies from WKWebView

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 4 20:20:43 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=198554

            Bug ID: 198554
           Summary: Unable to get cookies from WKWebView
           Product: WebKit
           Version: Safari 12
          Hardware: iPhone / iPad
                OS: iOS 12
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jeremyschonfeld at gmail.com

Created attachment 371369

  --> https://bugs.webkit.org/attachment.cgi?id=371369&action=review

Cookies shown in the safari web inspector after passing the login page in the iOS simulator

I am currently using a WKWebView to authenticate a user via a website in my app. Ideally, the web view is presented, the user enters login information, the website responds with the proper authentication cookies, and then the app retrieves the cookies from the web view to use in later background URLSession requests. However, I am unable to get the cookies after login. I can clearly see through the Safari web inspector that the cookies appear after moving past the login page (see attached screenshot). However, I cannot retrieve the cookies via code. I tried setting the view controller as the WKHTTPCookieStoreObserver with "webView.configuration.websiteDataStore.httpCookieStore.add(self)" in viewDidLoad() of the view controller, but the delegate method "cookiesDidChange" is never called. Additionally, I attempt to call "webView.configuration.websiteDataStore.httpCookieStore.getAllCookies" in webView didFinish navigation, however the callback only returns the cookies half of the time seemingly randomly. The other half of the time, the callback returns an empty list or other cookies (not the authentication cookies I see in the web inspector). This issue is blocking me from adding a functioning login view to my app. I spoke to some of the WebKit developers (Chris and John) at the WWDC lab today.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190605/68edf757/attachment-0001.html>


More information about the webkit-unassigned mailing list