I want to execute a POST via the XMLHttpRequest Object below in TypeScript. Sadly I keep getting the following error:
407: Proxy Authentication Failed. Forefront TMG requires authorization to fulfill the request.
My Code:
var oReq = new XMLHttpRequest();
oReq.withCredentials = true;
oReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
oReq.open("POST", "https://api.sandbox.paypal.com/v1/oauth2/token", true, clientID, secret);
oReq.onload = function() {
console.log(oReq.responseText);
};
oReq.send();
I went through several Posts on how to configure a proxy for these requests but nothing really worked. Since our Proxy only supports ntlm I tried installing cntlm and setting the proxy to http://credentials@localhost:Port
which worked for installing stuff via npm but sadly not for this issue. The only thing I did not try is configuring the proxy within the code. I did not find a way to configure it with my credentials which I need to pass.
There is no way to use the XHR in my context via emulator, since I was using Xcode 7. Xcode does not support the usage of a proxy that requires authentication since Xcode 6.
Reference:
iOS Simulator does not support the use of network proxy servers that require authentication. (14889876)
from the Xcode 6 Release Notes.