title: Cross-Origin Request Blocked when accessing O365 Rest API
body: <p>I'm attempting to creating a partial mail client in an asp.net mvc application.  I'm not using the .net API's as I'm required to get the messages on the client side via javascript. </p>
  
  <p>Unfortunately, I get the following error when attempting to get messages via an ajax request.</p>
  
  <blockquote>
    <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading
    the remote resource at
    <a href="https://outlook.office365.com/api/v1.0/me/messages" rel="nofollow">https://outlook.office365.com/api/v1.0/me/messages</a>. This can be fixed
    by moving the resource to the same domain or enabling CORS.</p>
  </blockquote>
  
  <p>this is my ajax request</p>
  
  <pre><code>    jQuery.ajax({
          url: "https://outlook.office365.com/api/v1.0/me/messages",
          type: "GET",
          headers: { "Authorization": authToken },
          success: function (response) {
              debugger;
              // response
          },
          error: function (request, errorType, error) {
              debugger;
          }
      });
  </code></pre>
  
  <p>Any idea what i'm doing wrong here?  I don't know much about CORS.</p>