Search results for

ASWebAuthenticationSession cookie

1,295 results found

Post

Replies

Boosts

Views

Activity

Authenticate Safari Extension with Web Application
Hi :) I am building browser extension that is integral part of our bigger web service. Since it needs to authenticate with our web application to use its api. Extension was originally developed for the Chrome and there everything works perfectly fine without any additional work. When I am authenticated on the platform I am able to use extension on any website and while making api calls from extensions background script to the platform backend the cookie is automatically attached to it. I just do fetch without any headers etc everything works out of the box. Then I used the xcrun safari-web-extension-converter and converted the chrome extension to safari. I tested local build as well as build submitted to test flight and none of these seems to work the same way as on chrome. Meaning I am not able to make this safari extension pick up the cookie from my web application. I found that if I disable: prevent cross-site tracking in Safari Settings it works. But obviously its not a solution for the
3
0
972
Aug ’24
Reply to Authenticate Safari Extension with Web Application
Ok I managed to solve the problem :OO Leaving the answer to someone that may have same problem in the future :D In my manifest file I had to change background.service_worker to background.scripts. Apparently service_worker runs on the separate thread and has limited browser context hence no access to the cookies If you use background.scripts instead it will make extension generate persistent background page that has a possibility to pickup the cookies :D Everything works out of the box now :D
Topic: Safari & Web SubTopic: General Tags:
Aug ’24
Reply to Authenticate Safari Extension with Web Application
Thanks for response. This will mean that I have to start develop in swift which I am trying to avoid. I found other very similar extension that seems to work the same way. The difference that I see between ours is that when I enter Develop > Web Extension Background Content: 3rd Party Extension I can see generated_background_page.html in the Sources Tab that loads the background script. I can also see all the devtools tabs like on any other website. In Networking tab can see all the requests made. Interesting thin is that if I make the fetch request from the Console of this background script to our service... the cookie gets attached automatically and I am able to use the api. My Extension While when I enter background script of my extension I can see only three dev tools tabs: Console, Network and Sources. In Sources I have only service-worker.js file and none of html files. On the Network tab I can't see any requests send for example when I open extension popup yet.. in Console I can see all the
Topic: Safari & Web SubTopic: General Tags:
Aug ’24
Cookies set by AJAX responses not accessible by JS when using WKWebView
Hi, we have really weird issue with one of our website embedded into iOS app using WKWebView. The website has CSRF mechanism implemented and is using some AJAX calls when user interact with it and in response some cookies are returned. Then the JS code wants to access these cookies to set proper value for next request header. Unfortunately when using document.cookie JS command these cookies are not there. However they are sent within another requests and I can see them from Safari Developer Inspector connected to my device or iOS Simulator. Another interesting thing is that the same website and solution works fine on Safari browser and with SFSafariViewController displayed inside our app. We've tried using various things for WKWebView configuration like nonPersistent data store, but without success. Does anyone have any idea how to deal with such issue and why it doesn't work with WKWebView?
Topic: Safari & Web SubTopic: General Tags:
1
0
583
Jun ’24
Captive Network Assistant
Questions:Is it possible to set up Facebook login for use in the CNA?If so, please provide links to examples if they exist.Does CNA documentation exist for developers?If so, please provide a link.Can you debug the CNA screen with developer tools?If so, how?Is it possible to force the use of Safari instead of the CNA?If so, how?Details:I have created a captive portal login page that uses an email submission form or a Facebook login button. The login button uses javascript as documented on Facebook's developer resources to open a window and log the user in.Testing:CNA:Clicking the Facebook sign in button redirects to the facebook login after multiple clicks. Facebook login page allows submission of username and password but does not generate these entries from cookies. After submission, the page is blank and login is not completed.Full Featured Browsers:In Safari, Chrome, Firefox, etc. the social sign is functioning and works as expected. All browsers redirect the user to the login page, the user may u
2
0
12k
Sep ’16
ASWebAuthenticationSession does not work for some reason for an OAuth Authorization Code grant
Hi there, I'm having some trouble with getting a OAuth Authorization Code redirect with a custom scheme to work with ASWebAuthenticationSession. I am trying to build an app that integrates with an authentication provider, in which I have configured like this: Callback URL: myapp://auth In my iOS app, I have define this as a custom scheme in my info.plist file. CFBundleURLTypes CFBundleTypeRole Editor CFBundleURLName com.abc.def CFBundleURLSchemes myapp Excuse the messy-ish code below, but I just want to see this work. import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { AContentView() .onOpenURL { url in print(Received URL in onOpenURL: (url)) Self.handleURL(url) } } } static func handleURL(_ url: URL) { print(Handled URL: (url)) } } import AuthenticationServices struct AContentView: View { @Bindable var viewModel = SomeViewModel() @State private var authSession: ASWebAuthenticationSession? @State private var presentationContextProvider = PresentationContext
2
0
1.3k
Jul ’24
ASWebAuthenticationSession and additionalHeaderFields
I'm trying to set a Cookie on ASWebAuthenticationSession on iOS 17.4+ using the new available method additionalHeaderFields. I can use this method to set any header field but Cookie. As soon as I try to set this header, I receive the following error: Cannot start ASWebAuthenticationSession: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=1 One or more provided headers are invalid. UserInfo={NSLocalizedFailureReason=One or more provided headers are invalid.} The same content, but with different name (Foo) is inserted as a header in the request. So, are there any limitation about setting cookies on ASWebAuthenticationSession? I've found any information abut this
1
0
804
Jul ’24
Reply to ASWebAuthenticationSession does not work for some reason for an OAuth Authorization Code grant
Interestingly, I left a simulator running for a long while and came back to my desk and hit the authenticate button. The Safari view caused by using ASWebAuthenticationSession came up, was blank/invalid, and I got a callback from the authentication provider.. The header that caused this was: Location: myapp://auth#state=17A26C7A-AFDE-4C3B-BA89-85FAA343F0DB&error=invalid_request_object&error_description=Expired%20jwt I'm partially happy it worked at least once, but am also confused it doesn't work when it should
Topic: Privacy & Security SubTopic: General Tags:
Jul ’24
Reply to iOS 18 mac address rotation
This is going to be a problem for a lot of people and we probably need to raise developer awareness Previously the setting would cause the Mac Address to rotate each time you connect to a wifi network; turn it off stopped that and your hardware address would be used (or perhaps the random one just stayed the same). Now for iOS and MacOS there no way to stop it rotating each time you connect to anything. The new on/off switch controls whether the address rotates while you are still connected after XX minutes. This is an absolute disaster for the following situations: Networks where you want to pin a device to an IP address via DHCP Reservations so that you can QoS traffic going to that device. Networks were you want to lock children to an IP Address so that you can parent control what those kids can do on the internet. AirPlane and Hotel Hot Spots that you buy 5 hours of usage at high speed that link to your mac address Networks with really Long DHCP lease times to ensure stablility will find that Apple Device
Jul ’24
Cookie sharing between ASWebAuthenticationSession and Safari (ios)
I'm currently trying to add an OIDC connection to an iOS application. I'm using AppAuth, which will use ASWebAuthenticationSession (because we're targeting recent versions of iOS). We have a login web page that will write a cookie. We'd like this cookie to be shared between the application (using ASWebAuthenticationSession) and the system browser (Safari) so that the user can be recognized and avoid having to log in again. The web page writes a permanent cookie (with an expiry date) and the iOS application uses ASWebAuthenticationSession. And I did not set prefersEphemeralSession to true. So we should be OK with the documentation (SFSafariViewController no longer shares cookies, and session cookies are not shared between ASWebAuthenticationSession and Safari). It should work, if I understand the documentation correctly. Did I miss a point? Or is it a known problem? I also tried to create a simple web page that read and write a cookie
1
0
1.7k
Apr ’24
NavigationStack with NavigationPath triggers multiple init/deinit of views in stack
Hi all 👋 I've stumbled upon what I think is a bug in SwiftUI, but there might be an explanation for it, which I cannot to figure out. So here's the bug. Perhaps any of you know it. In short I found out that .navigationDestination(for: ...) runs multiple times when you abstract the logic away from the scope of the closure, into a function that should return the desired view from the type of destination. But if you keep the logic inside the scope of the closure it only runs once per destination. The longer explanation I've setup a small example of a setup, which I'm planning on building an entire app on. Basically it's MVVVM with a coordinator pattern. I've ditched the coordinator in this example to minimize code, but the router is present and is key to how the app should work: navigation happens from a central place at the root of the app. You should be able to copy all the code into a single file and run the app, to see what happens. It's a simple app with a rootview that can navigate to either Cookies
Topic: UI Frameworks SubTopic: SwiftUI
2
0
733
Jul ’24
Reply to NavigationStack with NavigationPath triggers multiple init/deinit of views in stack
@Knyhuus an identical function similar to what you have in the scope of the .navigationDestination(for:) closure would be: @ViewBuilder func itemViewFor(destination: Destination) -> some View { switch destination { case .cookie: CookieView() case .milk: MilkView() } } Secondly, StateObject property wrapper should be marked private and instantiated with the View.
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’24