title: withCredentials AngularJS request POST error
body: <p>I can't seem to send <code>$http.post</code> requests for authentication. My code matches the solution on this page <a href="https://stackoverflow.com/questions/13741533/angularjs-withcredentials">AngularJS withCredentials</a>  but I get this error through my browser console.</p>
  
  <pre><code>Credentials flag is 'true', but the 'Access-Control-Allow-Credentials' header is ''. It must be 'true' to allow credentials.
  </code></pre>
  
  <p>This is what the code looks like:</p>
  
  <pre><code>$scope.authenticate = function (user, pass) {
      $http.post(authUrl, {
          username: user,
          password: pass
      }, {
          withCredentials: true  
      })
  }
  </code></pre>
  
  <p>I'm still new to angularJS but I read another site for help on setting custom headers, so I could fix the error message regarding the header. I tried to use:</p>
  
  <pre><code>$httpProvider.defaults.headers.post = { 'Access-Control-Allow-Credentials' : 'true' }
  </code></pre>
  
  <p>but I can't seem to get it right without <code>$httpProvider undefined</code> errors. I put it above the <code>$http.post</code> call, and also in the controller's function scope:</p>
  
  <pre><code>    .controller("authCtrl", function($scope, $http, authUrl, $httpProvider) {
  </code></pre>
  
  <p>Any ideas?</p>