Search results for

ASWebAuthenticationSession cookie

1,295 results found

Post

Replies

Boosts

Views

Activity

Reply to iOS 11.3: WKWebView cookie synchronizing stopped working
Thanks for jumping on this issue.We are using RxSwift for async flow management instead of dispatch group. And I'm pretty sure that all injections happened before web view loaded.A few interesting notes about this:1) injection works well on both 11.2.6. and 11.3. I could see cookies in the httpCookieStore2) on 11.2.6 cookies are attached to the web page as expected3) on 11.3 WkWebView just ignore them 4) adding the delay in web view load for 3-10 seconds doesn't fix the issue5) after the application start web view loaded without cookies but if I change user (try to set new cookies) then cookies become attachable.
Topic: Safari & Web SubTopic: General Tags:
Apr ’18
Reply to iOS 11.3: WKWebView cookie synchronizing stopped working
eskimo, here is the code snippet with dispatch group that works nice on iOS 11.2.6 and stop working on 11.3 override func viewDidLoad() { super.viewDidLoad() let pool = WKProcessPool() let configuration = WKWebViewConfiguration() configuration.processPool = pool let webView = WKWebView(frame: view.bounds, configuration: configuration) view.addSubview(webView) let sem = DispatchGroup() cookies.forEach { cookie in sem.enter() configuration.websiteDataStore.httpCookieStore.setCookie(cookie, completionHandler: { sem.leave() }) } sem.notify(queue: .main) { let url = URL(string: https://some-private-link.com) let request = URLRequest(url: url) webView.load(request) } } fileprivate var cookies: [HTTPCookie] { let isEnvSecured = true var emailCookieProperty: [HTTPCookiePropertyKey: Any] = [ HTTPCookiePropertyKey.domain: some-private-link.com, HTTPCookiePropertyKey.path: /, HTTPCookiePropertyKey.name: X-User-Email, HTTPCookiePropertyKey.value: some@example.com] if isEnvSecured { emailCookieP
Topic: Safari & Web SubTopic: General Tags:
Apr ’18
Reply to Setting cookies with WKHTTPCookieStorage do not sync with wkwebview
Below are some code snippets from our implementation. Again, all of this worked fine prior to iOS 11.3. I tried adding an observer to the WKHTTPCookieStore associated with the WKWebView instance, but cookiesDidChange never seems to be hit. // Create the WKWebView instance. Add a cookie store observer. if #available(iOS 11, *){ wkWebView = WKWebView() wkWebView!.scrollView.delegate = self wkWebView!.configuration.websiteDataStore.httpCookieStore.add(OnShiftWKHTTPCookieStoreObserver()) } // this is how we're adding cookies to our WKWebView instance. public func writeCookies(cookies: [[HTTPCookiePropertyKey : Any]]) { if #available(iOS 11, *) { let cookiesStore = wkWebView.configuration.websiteDataStore.httpCookieStore cookies.forEach { (cookie) in guard let cookie = HTTPCookie.init(properties: cookie) else { return } cookiesStore.setCookie(cookie, completionHandler: { print (cookie added: (cookie.name)) }) } } } // This is our WKHTTPCookieS
Apr ’18
Reply to How to synchronize cookies in WKWebview
The WKHTTPCookieStore not working on iOS 11.3 I tried below options but nothing worked for melet auc = HTTPCookie.init(properties: [HTTPCookiePropertyKey.name: OAuth.AccessToken, HTTPCookiePropertyKey.value: authToken, HTTPCookiePropertyKey.domain: .myDomain.com, HTTPCookiePropertyKey.path: /, HTTPCookiePropertyKey.secure: TRUE]) // Here I tried two options, setting the cookie in configuration before the webview // is created and also after the webview is created. if let ac = auc { if #available(iOS 11.0, *) { webView.configuration.websiteDataStore.httpCookieStore.setCookie(ac) { DispatchQueue.main.async { self.webView.load(checkoutRequest) } } } else { // fallback } }
Apr ’18
Reply to iOS 11.3: WKWebView cookie synchronizing stopped working
I am facing similar issue. I need to set an authentication cookie and the code works fine on iOS 11.2 I am able to see in Charles that the cookie is set and I am able to open the authenticated webpage in WKWebView but the same code doesnt work on iOS11.3 Even in charles I see that the cookie is not set. Below is what I am trying://Create webview let webView = WKWebView(frame: .zero, configuration: WKWebViewConfiguration()) //Add webview to the UI //.... //Set the cookie let authCookie = HTTPCookie.init(properties: [HTTPCookiePropertyKey.name: OAuth.AccessToken, HTTPCookiePropertyKey.value: some_authToken, HTTPCookiePropertyKey.domain: .somedomain.com, HTTPCookiePropertyKey.path: /, HTTPCookiePropertyKey.secure: TRUE, HTTPCookiePropertyKey.expires: Date.distantFuture]) if let reqCookie = authCookie { webView.configuration.websiteDataStore.httpCookieStore.setCookie(reqCookie) { DispatchQueue.main.async { self.webView.load(checkoutRequest) } } }
Topic: Safari & Web SubTopic: General Tags:
Apr ’18
Reply to Setting cookies with WKHTTPCookieStorage do not sync with wkwebview
I spent some time on this issue as well. I managed to get my app working again, with the following two alterations:1. Before creating the WKWebView, observe the default WKWebsiteDataStore instance for cookie changes.// These two lines occur in the viewDidLoad method of a UIViewController class // This view controller conforms to the WKHTTPCookieStoreObserver protocol WKWebsiteDataStore.default().httpCookieStore.add(self) let webView = WKWebView() // Configure and load the web view2. In the cookiesDidChange(in:) method of your WKHTTPCookieStoreObserver, retrieve the cookies from the WKHTTPCookieStore asynchronously, on the main thread.func cookiesDidChange(in cookieStore: WKHTTPCookieStore) { DispatchQueue.main.async { cookieStore.getAllCookies { cookies in // Process cookies } } }Now my app runs successfully on iOS 11.3 and 11.3.1.
May ’18
Reply to iOS 11.3: WKWebView cookie synchronizing stopped working
The problem seems to be something with threads, if I add an observer to the cookie store with the following code:// In viewDidLoad let authCookie = HTTPCookie.init(properties: [HTTPCookiePropertyKey.name: OAuth.AccessToken, HTTPCookiePropertyKey.value: some_authToken, HTTPCookiePropertyKey.domain: .somedomain.com, HTTPCookiePropertyKey.path: /, HTTPCookiePropertyKey.secure: TRUE, HTTPCookiePropertyKey.expires: Date.distantFuture])| WKWebsiteDataStore.default().httpCookieStore.add(self) WKWebsiteDataStore.default().httpCookieStore.setCookie(authCookie) public func cookiesDidChange(in cookieStore: WKHTTPCookieStore) { print(Cookies did change) cookieStore.getAllCookies { (cookies) in print(Cookie exists?: (cookies.contains(where: { $0.name == OAuth.AccessToken }))) } DispatchQueue.main.async { cookieStore.getAllCookies { (cookies) in print(Cookie exists on main thread?: (cookies.contains(where: { $0.name == OAuth.AccessToken }))) } } }Then the output is:Cook
Topic: Safari & Web SubTopic: General Tags:
May ’18
Getting crash while integration safari push notification using APNS
Hello ,We are integrating Safari Push Notification and able to resolve all the error by refeering to the log api created .Now the issue callback function is not getting called and upon referring safari logs, below crash comes.Process: SafariNotificationAgent [1403]Path: /usr/libexec/SafariNotificationAgentIdentifier: SafariNotificationAgentVersion: 7601.7.7Code Type: X86-64 (Native)Parent Process: ??? [1]Responsible: SafariNotificationAgent [1403]User ID: 502Date/Time: 2018-05-03 16:18:20.021 +0530OS Version: Mac OS X 10.11.6 (15G20015)Report Version: 11Anonymous UUID: 3D78A2D7-6A9F-67BE-5334-2163E7CE3FE8Sleep/Wake UUID: BC7B5C11-4D13-4189-ACF0-9CD4316D4E43Time Awake Since Boot: 9500 secondsTime Since Wake: 3100 secondsSystem Integrity Protection: enabledCrashed Thread: 6 Dispatch queue: com.apple.SafariNotificationAgent.VerificationException Type: EXC_CRASH (SIGABRT)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note: EXC_CORPSE_NOTIFYApplication Specific Information:*** Terminating app due
Topic: Safari & Web SubTopic: General Tags:
0
0
563
May ’18
SFSafariViewController reads wrong cookies
I have the following problem in SFSafariViewController.It looks simliar to the CVE-2018-4110 bug.https://nvd.nist.gov/vuln/detail/CVE-2018-4110Does anybody face the same problem?## Step to reproduction**When visit new page**1. Open a website by Safari2. Go to the app which uses SFSafariViewController3. Open the same website in SFSafariViewController4. It occasionally reads cookies from Safari.**When reopen the same page again**1. Launch an app which uses the SFSafariViewController.2. Open a page in SFSafariViewController.3. Close and back to the same web site again.4. It occasionally reads cookie from the previous session of the same page before new cookie is set.## Expected behaviorSFSafariViewController should not read cookies both from Safari or from the previous session.## EnvironmentiOS 11.3.1iPhone X
Topic: Safari & Web SubTopic: General Tags:
3
0
1.1k
May ’18
Reply to Smart-app-banner is shown but validation tool fails
I went to check your apple-app-site-association file and noticed that it bounces through a redirect: $ curl -D /dev/stderr https://www.cneubauer.net/.wellknown/apple-app-site-association HTTP/2 301 content-type: text/html; charset=utf-8 content-length: 0 location: https://www.cneubauer.net/de/.wellknown/apple-app-site-association date: Tue, 08 May 2018 07:19:18 GMT server: Apache x-powered-by: PHP/7.0.29 expires: Wed, 17 Aug 2005 00:00:00 GMT cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache, no-cache set-cookie: 9f4aeabf5e5d023ef91c718fb97d46df=106305b04a0d15ceeb0704b6b308709e; path=/; HttpOnly last-modified: Tue, 08 May 2018 07:19:18 GMT $That’s not allowed, per the App Search Programming Guide which says:The file needs to be accessible via HTTPS—without any redirects—at https://<domain>/apple-app-site-association or https://<domain>/.well-known/apple-app-site-association. Share
Topic: App & System Services SubTopic: General Tags:
May ’18
Reply to iOS 11.3: WKWebView cookie synchronizing stopped working
Hey @eskimo and others: We had the same problem here, and I believe I've found the true cause and solution. This change (https://github.com/WebKit/webkit/commit/d9d6e5c82c4a74cd573f3f119f166ffcee477b04) caused WebKit to prevent initializing the WKWebsiteDataStore until necessary. We have a flow in our app where, if the webview attempts to navigate to a particular URL that requires a cookie, we cancel the navigation, download and set a cookie, and in the cookie setter's completion handler, load the original request (this time with the cookie).However, since we've canceled the navigation, the WKWebView doesn't see the creation of the data store necessary and queues our completion handler. The URL is never loaded, since our completion handler is never called. It's almost like a deadlock.Since this isn't the behavior I'd expect, I filed this as rdar://40100673 and https://bugs.webkit.org/show_bug.cgi?id=185483.Here's our problematic code, and a workaround, which forces the crea
Topic: Safari & Web SubTopic: General Tags:
May ’18
Reply to iOS 11.3: WKWebView cookie synchronizing stopped working
I tired to remove the cookies before loading the webview like this. It works for me. But I do not want to remove the cookies everytime I load the webview. So its workaround not a solution. let group = DispatchGroup() group.enter() webView.configuration.websiteDataStore.removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(), modifiedSince: .distantPast) { group.leave() } group.notify(queue: .main) { self.fillWebViewCookieStore(webView.configuration.websiteDataStore.httpCookieStore) { webView.load(request) } }
Topic: Safari & Web SubTopic: General Tags:
May ’18
Read Cookie with PHP from WebView (iOs Xcode/Swift)
I want to read a cookie from an WebView (iOs) in PHP. It doesn't work.First, I set an cookie named testcookie with value test and expiredate 2099 in xCode for my WebView Application and check the Log. I got the info, that my cookie saved successfully. Second, I start the simulator and opened my .php Script. In my .php Script I have the following code:$testcookie = htmlentities($_COOKIE[testcookie], ENT_QUOTES);echo $testcookie;After my webview has loaded the .php script, it shows me nothing.So now my question, is it possible to read the cookies with php, which i have set in the webview.Sorry for my bad English.Thanks a lot!
11
0
3.0k
May ’18