I want to make a rest call to get web properties (i.e. /_api/web), for a different web application than the current. I have added the response headers

Access-Control-Allow-Credentials : true
Access-Control-Allow-Origin : *
Access-Control-Request-Method : GET,POST,HEAD,OPTIONS

in IIS.

Then I tried to make a ajax call

    $.support.cors = true;
        url: "http://othersite/_api/web",
        type: "GET",
        //timeout: 8000,
        //contentType: "application/json;odata=nometadata",
        //cache: false,
        headers: {
            "Accept": "application/json;odata=verbose"
        xhrFields: { withCredentials: true },
        success: function(data) {
        error: function(jqXHR, textStatus, errorThrown) {

but it doesn't work. I get 401 unauthorized. Does anyone know what is wrong?


I even tried this


but same problem.

  • I'm facing the same problem and the last answer was: You can't. So I create a web service and I connect to the other site with CSOM with credentials.
    – Marco
    Nov 15, 2016 at 17:59
  • Are the two site collections in different domains? I've used REST across site collections with no issues, but they're in the same domain.
    – wjervis
    Nov 15, 2016 at 18:48
  • Its actually in different web applications, so one site is mysite and the other is mysite:9000. I believe this is considered different domain.
    – omega
    Nov 15, 2016 at 18:51
  • you are getting 401 because you are not authorized to your second web application. Nov 16, 2016 at 6:08
  • Do you have permission on the second site collection?
    – Karthik
    Mar 8, 2018 at 17:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.