We are trying to establish username-password authorization from javascript (visualforce or lightning) but this doesn't work.
We are trying to login from Organization A to Organization B.
POST request payload is the following
'<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">'
+ '<Header/><Body><login xmlns="urn:partner.soap.sforce.com">'
+ '<username>' + USERNAME + '</username><password>' + PASSWORD + '</password>'
+ '</login></Body></Envelope>'
and it is sent to http://login.salesforce.com/services/Soap/u/43.0.
It is working fine from POSTMAN but it is not working from Visualforce page because the following error is failing
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
We tried to use custom login domain and we tried to add everything to whitelist like it is described here.
Nothing worked.