title: CakePHP REST API giving 403 for AJAX but not for cURL
body: <p>I have built a REST API using CakePHP and I'm having the following trouble.</p>
  
  <p>If I execute</p>
  
  <pre><code>curl -v -H 'ACCEPT: application/json' -u sam:hello http://localhost/journeys/latest.json
  </code></pre>
  
  <p>I get the expected response which is:</p>
  
  <pre><code>{"journey":{"Journey":{"id":"17","description":null,"created":"2013-01-31 23:02:54","modified":"2013-01-31 23:02:54","user_id":"3"}}}
  </code></pre>
  
  <p>I have then attempted to incorporate this API in to some JavaScript I've written where I can request that latest journey data and then extract the id for use.</p>
  
  <p>The Javascript I've written is as follows:</p>
  
  <pre><code>  Server.getLatestJourney = function() {
  $.ajax({
      type: 'GET',
      contentType: 'application/json',
      url: 'http://localhost/journeys/latest.json',
      dataType: "json",
      username: 'sam',
      password: 'hello',
      success: function(data, textStatus, jqXHR){
          latestJourney = data.journey.Journey.id;
          console.log('Laters journey id = ' + latestJourney);
      },
      error: function(jqXHR, textStatus, errorThrown){
          console.log('Latest Journey error: ' + textStatus + ' Error: ' + errorThrown);
      }
  });
  }
  </code></pre>
  
  <p>When that piece of code executes I get the following error in the JavaScript console</p>
  
  <pre><code>GET http://sam:hello@localhost/journeys/latest.json 403 Forbidden 91ms
  </code></pre>
  
  <p>I am totally stumped with this one. Any help would be greatly appreciated. </p>