Access to an API Problem with CORS

0

I have a problem making calls to an API. The application is located inside the intranet, but the server does not have a standard server (there is no nodejs, or apache) where you can make changes, but it has been programmed, and it is an application .exe responsible for the management of the web in the ports.

In theory, developers can make calls to the API on the server, but when the web runs from another computer within the intranet, we have problems with CORS.

Is there a way to be able to bypass it?

This is the request

function login(){
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/Users/Login?callback=?", true, "user", "password");
xhr.responseType = 'jsonp';
xhr.onload = function(){
    if (status==200){
        var resultsText = xhr.response;
        var results = JSON.parse(resultsText);
    }else{
        console.log("error");
    }        
}
xhr.send();

}

I have tried to change the type of response by jsonp, but it does not work. Any ideas?

The error I receive is ...

in IE

SCRIPT5022: InvalidAccessError

and in firefox

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/apiGUI/Results?callback=?. (Reason: CORS request did not succeed)
    
asked by Roberto Gimenez 26.10.2018 в 15:28
source

0 answers