Hi, I am not able to set and retrieve cookies from WKWebsiteDataStore when running the following test. The getCookies in the below code always comes empty. I dont understand its failing because it is unable to set the cookie or the get is failing to retrieve cookies. Here is the code: let cookieStorage = WKWebsiteDataStore.nonPersistent().httpCookieStore let properties: [HTTPCookiePropertyKey: Any] = [ .domain: abc.com, .path: /, .name: name, .value: value, .secure: TRUE ] let cookie = HTTPCookie(properties: properties)! let cookies = [cookie] let cookieExpectation = self.expectation(description: cookieExpectation) cookieStorage.setCookie(cookies[0]) { cookieStorage.getAllCookies { getCookies in let mappedCookies = Dictionary(uniqueKeysWithValues: cookies.map { ($0.name, $0.value ) }) let mappedGetCookies = Dictionary(uniqueKeysWithValues: getCookies.map { ($0.name, $0.value ) }) XCTAssertEqual(mappedCookies, mappedGetCookies) cookieExpectation.fu
Search results for
ASWebAuthenticationSession cookie
1,295 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I've built[1] a quick prototype[2] with PATs It appears that ios16 only successfully provides the token challenge once every minute. Is this intentional? From an implementation perspective, are website implementors intended to: add add a cookie to capture the state of a previous successful challenge? should we use the max-age= and expect the Authorization token to repeated during burst of requests? should we present unique redemption contexts on each request? is there a way to get context on why the token generation failed (eg: issuer cannot be contacted? malformed challenge?) General feedback: debugging tools would be useful to know if the challenge or issuer has issues. Even console debug messages would be appreciated issuer requests bypass any proxy setups with root-CAs (related to debugging needs) [1] https://github.com/colinbendell/private-access-token [2] https://private-access-token.colinbendell.dev/test.html
I've solved this issue, I just had to clean cookies for the SFSafariViewController (I've done that in PHP)
Topic:
Programming Languages
SubTopic:
Swift
Tags:
I have the same issue and found no solution yet. But at least Mac OS Ventura Beta stopped deleting the cookies from the browser when the extension fails to get them. So there is some progress there, but the bug is still not solved.
Topic:
Safari & Web
SubTopic:
General
Tags:
Hi, I know this is a 1-year-old post, but have you found a solution to this problem? I'm currently dealing with a similar issue but with SameSite=Strict attribute, and the cookie isn't set. I don't want to set SameSite=None so I'm left looking for alternatives. Thanks.
Topic:
Safari & Web
SubTopic:
General
Tags:
I'm porting a Chrome extension to Safari. All works well besides the auth flow, which uses SameSite=Strict cookies. On Chrome, such cookies are easily set and work as expected, but not on Safari. Now, as I understand, technically, requests from chrome-extension:// and safari-web-extension:// origins are cross-site in relation to the server, which makes me think that on Chrome, the SameSite=Strict attribute is simply ignored as an exception for extensions. With that said, the backend team wants to keep the attribute for security reasons and so removing it or replacing it with SameSite=None isn't an option. Is this an intended behavior of Safari or a bug? Is there a way to get around this without changing the attribute?
My iOS application uses WKWebView to login to the application. Recently the application release has been rejected by Apple team for using WKWebView for login. Instead they suggested to go with SFSafariController. I need to clear the cookies before hitting the login url for fresh login. In WKWebView, I can clear cookies before opening an URL. I don't find an option to clear cookies in SFSafariController. If we dont clear auth cookies, user is getting auto logged into the app because of the existing cookie. Is there a way to clear Auth cookies in SFSafariViewController?
In versions of Safari going back at least a year, when the Develop menu is on, all cookies are expired hours after being set. I'm using Version 16.1 (18614.2.3.1.1) currently. I had the problem for a long time before discovering the cause (in a MacRumours forum post). I’d rather not have to keep using Chrome for development work, but that's what I have to do until this issue is resolved. Does anyone know of a workaround or at least whether the problem has been acknowledged?
SOLUTION FROM APPLE: I've got a reply from Apple support as follows: Follow this basic troubleshooting to attempt to solve it as this issue was previously reported and solved by our engineering team on August 8th. Make sure you are using the latest version of your browser. Clean the cache, cookies and history (all website data). Get out of your browser completely. Try again I would also like to recommend that you try Safari, since our website is optimized for Safari. If the error still appears, to better assist you, we need more information. Please provide the following: • Steps to reproduce the issue • Full-window screenshots or video illustrating the issue • Username of each user experiencing the issue • Web browsers that you were able to reproduce the issue in • Web browser version numbers • Apple ID of the In App Purchase **Works for me! **
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Trying to implement a type that conforms to ASWebAuthenticationPresentationContextProviding. This is now causing errors with Xcode 14. With the following implementation: final class PresentationContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding { func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { return ASPresentationAnchor() } } I get this compilation error: Call to main actor-isolated initializer 'init()' in a synchronous nonisolated context So I can annotate the class or method with @MainActor, but then I get this warning: Main actor-isolated instance method 'presentationAnchor(for:)' cannot be used to satisfy nonisolated protocol requirement Is there a way to fix this?
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Swift
Concurrency
wwdc2022-110356
Authentication Services
I create a singleton class to handle this SceneDelegate @available(iOS 13.0, *) func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { // handle here OAuthManager.instance.callBackUserActivity(userActivity: userActivity) } OAuthManager.swift import Foundation import AuthenticationServices protocol UserActivityListener { func callBackUserActivity( userActivity : NSUserActivity ) } class OAuthManager { public static let instance = OAuthManager() var asWebSession: ASWebAuthenticationSession? } extension OAuthManager : UserActivityListener { func callBackUserActivity(userActivity: NSUserActivity) { // Get URL components from the incoming user activity. guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, let incomingURL = userActivity.webpageURL, let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true) else { return } // Check for specific URL components that you need. guard let path = components.path, let params = components.queryItems else { return }
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Actually, it turns out I'm more interested in the above questions with regards to VPN for ASWebAuthenticationSession.
Topic:
Safari & Web
SubTopic:
General
Tags:
When I try to add my app for review for an update. The following error is displayed: The items below are required to start the review process: There are still screenshot uploads in progress. What I tried so far: Trying with different devices (Macbook, Windows) Deleting cookies and search history in the browser Trying with different browsers (Chrome MacOS, Chrome Windows, Safari MacOS) Trying with different IP addresses. Checking ALL THE SCREENSHOTS IN ALL LANGUAGES to ensure THERE IS NOT ANY SCREENSHOT IN UPLOAD PROCESS. Deleting all localized screenshots and using only default English-US screenshots for all localized languages. Deleting all the screenshots. Even in the case there is no screenshot at all, it prompts the same error. Here are the console logs when I click Add for Review button in Chrome Browser:
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Review
App Store
App Store Connect
When I try to add my app for review for an update. The following error is displayed: The items below are required to start the review process: There are still screenshot uploads in progress. What I tried so far: Trying with different devices (Macbook, Windows) Deleting cookies and search history in the browser Trying with different browsers (Chrome MacOS, Chrome Windows, Safari MacOS) Trying with different IP addresses. Checking ALL THE SCREENSHOTS IN ALL LANGUAGES to ensure THERE IS NOT ANY SCREENSHOT IN UPLOAD PROCESS. Deleting all localized screenshots and using only default English-US screenshots for all localized languages. Deleting all the screenshots. Even in the case there is no screenshot at all, it prompts the same error. Here are the console logs when I click Add for Review button in Chrome Browser:
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Review
App Store Connect
Hate this inconsistent functionality with Safari. Doesn't happen on iPadOS Safari, either. Been roughly a year here and good solution or informative yet. What's worse is, for me, this is resulting in a redirect loop at the network level and unfortunately Safari's DevTools interface doesn't even show basic HTTP requests that are pure 301 redirects. This would at least help me confirm that my issue is relating to cookies since then I could see the actual HTTP headers.
Topic:
Safari & Web
SubTopic:
General
Tags: