I have a desktop application where I am using CSOM to connect to the SharePoint Online site directly. The problem now is that this request has to be made through a proxy server. What I have done so far is that I have passed the proxy servers settings, including the credentials to the ExecutingWebRequest event of the ClientContext. However, the problem is the SharePointOnlineCredentials class. I have to set the Credentials of the ClientContext. When I am passing the userID & password to the constructor of this class, it is internally making a request to SP to validate the credentials. Now, I am unable to set/pass the proxy id/password to this class which is why the proxy server is refusing the request I am getting an IdcrlException. Below is the sample code I am using as of now.
SecureString passWord = new SecureString();
password.ToList().ForEach(passWord.AppendChar);
SP.ClientContext ctx = new SP.ClientContext(targetURL);
ctx.ExecutingWebRequest += (sen, args) =>
    {
         System.Net.WebProxy myProxy = new System.Net.WebProxy();
         myProxy.Address = new Uri(this.proxyUrl);
         myProxy.Credentials = new System.Net.NetworkCredential(this.proxyUserName, this.proxyPassword);
         args.WebRequestExecutor.WebRequest.Proxy = myProxy;
     };
//This is the line which is causing the issue. 
ctx.Credentials = new SP.SharePointOnlineCredentials(this.userName, passWord);
The code expectedly runs successfully on proxy servers which do not require any authentication. It's this SharePointOnlineCredentials that I am not able to configure. I have also tried to use NetworkCredentials in the place of SharePointOnlineCredentials. The code compiles successfully but SP is throwing Forbidden exception.