Search results for

ASWebAuthenticationSession cookie

1,295 results found

Post

Replies

Boosts

Views

Activity

Reply to URLSession is broken in iOS 18.4 RC Simulator
Well, that’s not good. I ran your test and was able to immediately reproduce the problem. [quote='777999021, fastred, /thread/777999, /profile/fastred'] Already submitted as FB17006003. [/quote] Thank you! I checked on your bug and the relevant folks have seen it. Your bug mentioned HTTP storage, so I tweaked your code to use an ephemeral session and the problem went away. let session: URLSession = { return URLSession(configuration: .ephemeral) }() Ephemeral sessions disable three standard things: cookie storage, the URL cache, and credential storage. So I tried creating a default session with those disabled: let session: URLSession = { let config = URLSessionConfiguration.default config.httpCookieStorage = nil config.urlCache = nil config.urlCredentialStorage = nil return URLSession(configuration: config) }() Annoying, that didn’t fix the problem. So the ephemeral session is disabling something beyond those three standard things. And that’s me out of obvious ideas )-: Clearly this is a bug that the
Mar ’25
Reply to URLSession works for request but not NWConnection
@DTS Engineer I am targeting multiple web servers that I don't have control over, but each thread/task will only target one specific server, so there is no need to manage cookies for multiple sites at the same time. These web-servers use a shared service so all the request/responses will be similar across. I could use the NWConnection solution that I already have which works but just unsure how to get the Set Cookies from responses and add them to next requests.
Mar ’25
Custom WkWebsiteDatastore
Hey team, I've integrated custom WkWebsiteDatastore to manage profiling for different sessions. upon testing the WkWebsiteDataStore as its mentioned to be persistent But The storage can be accessed via identifier, But the session data in storage is absent, such as cookies caches all are cleared when app is relaunched is it the default behavior to be expected or there is some property missing causing the session data to be removed from storage.
Topic: Safari & Web SubTopic: General Tags:
0
0
44
Mar ’25
Unexpected partition property set on cookies in iOS 18.4 beta
Apology for repost. I needed to fix the tags for original thread. https://developer.apple.com/forums/thread/777159 On iOS 18.3, I noted that partition HTTPCookiePropertyKey: StoragePartition is not observed to be set for cookies returned from the wkwebview cookie store. Now on 18.4 beta 4 we are now seeing those same cookies are populated with a partition property. Is there documentation for this change? Is it intended to be suddenly populated in 18.4? Now that partition property is set, HTTPCookieStorage.shared.cookies(for: serverUri) doesn't seem to return the expected cookies correctly. For context, we are using the cookies extracted from wkwebview, setting them in HTTPCookieStorage.shared and using URLSession to make network calls outside the webivew. Works fine once I forcefully set partition on the cookie to nil. More details on what the cookie looks like here: https://feedbackassistant.apple.com/feedback/16906526 Hopefully this is on your r
3
0
209
Mar ’25
Unexpected partition property set on cookies in iOS 18.4 beta
On iOS 18.3, I noted that partition HTTPCookiePropertyKey: StoragePartition is not observed to be set for cookies returned from the wkwebview cookie store. Now on 18.4 beta 4 we are now seeing those same cookies are populated with a partition property. Is there documentation for this change? Is it intended to be suddenly populated in 18.4? Now that partition property is set, HTTPCookieStorage.shared.cookies(for: serverUri) doesn't seem to return the expected cookies correctly. For context, we are using the cookies extracted from wkwebview, setting them in HTTPCookieStorage.shared and using URLSession to make network calls outside the webivew. Works fine once I forcefully set partition on the cookie to nil. More details on what the cookie looks like here: https://feedbackassistant.apple.com/feedback/16906526 Hopefully this is on your radar?
1
0
199
Mar ’25
fetch() in safari extension does not include credentials (cookie) when using from non-default profile
It seems fetch() does not include credentials (cookie) even when credentials: include is used and Safari extension has host_permissions for that domain when using from a non-default Safari profile. It includes credentials (cookie) when using from the default profile (which has the default name Personal). Is there anyone who has this problem? I try to request in popup.js like this: const response = await fetch( url, { method: 'GET', mode: 'cors', credentials: 'include', referrerPolicy: 'no-referrer', } ); and it does not include the credentials (cookie) from host_permissions. I already posted https://developer.apple.com/forums/thread/764279, and opened feedback assistant (FB15307169). But it is still not fixed yet. (macOS 15.4 beta 3) I hope this is fixed soon.
0
0
298
Mar ’25
Investigating CFNetwork Crashes on Older macOS Versions
CFNetwork None CFURLResponseGetRecommendedCachePolicy None 0 CFNetwork None CFHTTPCookieStorageUnscheduleFromRunLoop None 0 CFNetwork None /_/_CFNetworkAgentMessageProcessorMain None 0 CFNetwork None CFURLDownloadCancel None 0 CFNetwork None CFURLDownloadCancel None 0 libdispatch.dylib None /_dispatch/_block/_async/_invoke2 None We've observed intermittent crashes in our production environment, exclusively affecting customers running macOS 10.15 and 11. The crash logs consistently show a stack trace involving CFHTTPCookieStorageUnscheduleFromRunLoop and CFURLDownloadCancel within the CFNetwork framework. This suggests potential issues with cookie storage management and/or URL download cancellation. Could the team please analyze these crash logs and provide insights into: The root cause of the crashes. Potential race conditions or synchronization issues. Recommendations for mitigating or resolving the problem. Your assistance in resolving this issue is greatly appreciated.
4
0
236
Mar ’25
Use native Swift API for HTTP request with auth proxy
I'm simply trying to use a proxy to route a http request in Swift. I've tried using a URLSession Delegate but that results in the same issue with the iOS menu. proxy format: host:port:username:password When I run the code below I am prompted with a menu to add credentials for the proxy. I closed this menu inside my app and tried the function below again and it worked without giving me the menu a second time. However even though the function works without throwing any errors, it does NOT use the proxies to route the request. I've spent days on this and the only solution I found was using a NWConnection but this is super low level and now I need a shared session to manage cookies. If you want to see the NWConnection solution I made its here func averageProxyGroupSpeed(proxies: [String], completion: @escaping (Int, String) -> Void) { let numProxies = proxies.count if numProxies == 0 { completion(0, No proxies) return } var totalTime: Int64 = 0 var successCount = 0 let group = DispatchGroup() let queu
2
0
383
Mar ’25
Reply to Get cookies - Safari web extension iOS 18
The problem is solved by using storeId: async function getCookie(name, url) { const stores = await browser.cookies.getAllCookieStores(); for (const store of stores) { const cookie = await browser.cookies.get({ name, url, storeId: store.id }); if (cookie) return cookie; } return null; }
Topic: Safari & Web SubTopic: General Tags:
Mar ’25
Mobile apps and consent dialogue when logging in
We are using ASWebAuthenticationSession with apps on IoS to achieve SSO between apps. The IdP for authentication (OIDC) is an on-premise and trusted enterprise IdP based on one of the leading products in the market. Our problem is that the user is prompted for every login (and logouts) with a consent dialogue box: “AppName” wants to use “internal domain-name” to Sign In This allows the app and website to share information about you. Cancel Continue” I have read in various places that Apple has a concept of “Trusted domains” where you can put an “Apple certified” static web-page on the IdP. This page needs to contain specific metadata that iOS can verify. Once a user logs in successfully a few times, and if the IdP is verified as trusted, subsequent logins would not prompt the consent screen. Question: I struggle to find Apple documentation on how to go about a process that ends with this “Apple certified web-page” on our IdP”. Anyone who has experience with this process, or who can point me in some d
2
0
477
Mar ’25
WKWebView based Browser Yubikey&WebAuthn Support
TLDR: I’m searching for a possibility to allow the usage of passkeys and hardware keys for any website in a wkwebview INFO: The browser is macOS ONLY Hi, I couldn’t really find documentation or forums posts on how to implement Webauthn for signin or hardware security keys for a second factor. Or rather where those events are triggered to be handled. In Safari you have that popover, that lets you either authenticate through Passwords or with a security key. When I visit webauthn.io for testing and click either register or authenticate I get Told not to present authorization sheet: Error Domain=com.apple.AuthenticationServicesCore.AuthorizationError Code=1 (null) ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 (null) If I add func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping @MainActor (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) and func
Topic: Safari & Web SubTopic: General Tags:
2
0
526
Feb ’25
Share session from ASWebAuthenticationSession with WKWebView
Hello everyone, In my application, i have implemented authentication using ASWebauthenticationSession. However, when redirecting the user to a WKWebView, no cookies are shared, causing the session to be lost and requiring the user to log in again. Is there a way to share cookies between the two? If not, what would be the best approach to set up authentication that ensures SSO when switching to a WebView ? Thank you very much for your help !
1
0
447
Feb ’25