I have a web service (currently localhost:100) which uses Windows Authentication, is served through IIS and is set up with Access Control Allow Origin properties in the web.config:

<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="http://localhost:81" />
    <add name="Access-Control-Allow-Credentials" value="true" />
  </customHeaders>
</httpProtocol>

I'm trying to access them from an angularJS app served from static files (html, css & js) which is running from a different server which I'm running on IIS (port 81 currently):

var productSearch = $resource("http://localhost:100/api/ProductSearch/:id");

but I'm getting 401 (Unathorised).

I've set the requesting site to use Windows authentication but with no server side I've no way of knowing if that's working or not. It's not sending any user credentials through to the web service.

1

There are 1 answers

0
Stu On BEST ANSWER

So I was being a bit stupid. the line of code I was looking for was:

  $http.defaults.withCredentials = true;

This makes it work from anywhere - include the Node dev server.