ASWebAuthenticationSession initiated session, file:// URL is not loaded and "Confirm the file to load" is presented instead

We are relying on ASWebAuthenticationSession to do web authentication. Since the API doesn't support POST requests directly we have to generate local file in ~/Library/Application Support/<foo.bar>/WebAuth.html containing the POST and use initial URL as file:///Users/<User>/Library/Application%20Support/<foo bar>/WebAuth.html Problem is that Safari sometimes pops a dialog "Confirm the file to load" and sometimes it doesn't. This doesn't depend on "Full Disk access" TCC. Does anybody know a way to prevent this from happening? MDM option or something?

Also styling of the popup is a rather poor UI choice - looks very confusing and like the user may choose another file to load. Chrome f.e. doesn't do such popups. I already have FB13340210 for this.

Replies

While this doesn't directly answer your question, hopefully it's a better alternative. Starting in iOS 17.4 and macOS 14.4, you can now set additional headers in ASWebAuthenticationSession. https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession/4316246-additionalheaderfields