iOS keep showing “Proxy Authentication Required” d

2019-08-14 16:07发布

I am using NETunnelProviderManager for implementing VPN with HTTP/HTTPS proxy.

I have Basic Authentication from the Proxy server to authenticate with it, and I need to update password at regular time interval.

So to set credentials for Proxy Server I have implemented somethink like below:

self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer = [[NEProxyServer alloc] initWithAddress:proxyServer port:proxyPort];
self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer.authenticationRequired = YES;
self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer.username = proxyUser;
self.vpnManager.protocolConfiguration.proxySettings.HTTPSServer.password = proxyPassword;

After setting this detail I am saving preferences, and on next launch, if I load preferences I can find the value which I set there. But, when I start VPN and start accessing anything via VPN(Proxy) Proxy it immediately shows dialog Proxy Authentication Required. Just to double check, if I check the log of self.vpnManager.protocolConfiguration I can clearly see my password and username but still, It shows a dialog box for manual entry of user Credentials for Proxy.

Proxy Authentication Required

It would be really helpful if anyone can give me an idea on why my already configured proxy password and username is not considered if I set it programmatically in properties of NEProxyServer

Can anyone suggest something which can help me in updating the Credentials automatically in the background without asking a user to enter the Proxy credentials, something like delegate that we have in NSURLSession's case?

Any response and help would be appreciable.

0条回答
登录 后发表回答