Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How can I automate proxy authentication on iOS without user intervention


How can I automate proxy authentication on iOS without user intervention


To automate proxy authentication on iOS without user intervention, you can try the following approaches:

Use NEProxyServer Programmatically

- Set the proxyServer, port, username and password properties of NEProxyServer in your app's VPN configuration[1][2]
- However, this doesn't always work and the "Proxy Authentication Required" dialog may still appear asking the user to manually enter credentials

Enable Basic Authentication on the Proxy Server

- For example, with mitmproxy use the --proxyauth option to enable basic authentication[1]
- This works for HTTP but not always for HTTPS on iOS due to a protocol-level bug in mitmproxy versions after 8.1.0[1]

Whitelist Certain Destinations on the Proxy Server

- Consult with the proxy team to whitelist certain destinations that don't require authentication[2]
- This allows system processes to access internet resources without triggering the authentication prompt

Disable Authentication for Non-Authenticated Proxies on macOS

- On macOS, the issue can occur when system processes try to access resources before a Kerberos ticket is pulled from the proxy
- Allowing these processes to use a non-authenticated proxy can help resolve the prompts[1]

Debug for Unintended Redirects

- Check the app's code and proxy server configuration files for any unintended redirects that may be triggering the authentication dialog[1]

In summary, while there is no foolproof way to completely automate proxy authentication on iOS, using NEProxyServer programmatically, enabling basic auth on the proxy server, whitelisting destinations, and debugging for redirects are some techniques that may help minimize user intervention. However, the "Proxy Authentication Required" dialog will likely still appear in some cases due to protocol-level issues.

Citations:
[1] https://stackoverflow.com/questions/53852899/ios-keep-showing-proxy-authentication-required-dialog-even-after-passing-usern
[2] https://forums.developer.apple.com/thread/112201
[3] https://smartproxy.com/configuration/how-to-setup-proxy-for-iphone
[4] https://www.howtogeek.com/293676/how-to-configure-a-proxy-server-on-an-iphone-or-ipad/
[5] https://discussions.apple.com/thread/250375534