title: Azure App Service Authentication - 302 when trying to GET /.auth/me
body: <p>I have a reactjs web app which is hosted on Azure App Services, using App Service Authentication.</p>
  
  <p>My app authenticates properly and from inside the app I'm attempting to GET /.auth/me so that I can read the access tokens to use for some future API requests but am receiving a 302 in response. The response redirects to login.microsoft.com even though the first request (to load the app) has already been authenticated.</p>
  
  <pre><code>const headers = {
      'Accept': 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'credentials': 'include'
  };
  
  return (dispatch) =&gt; {
      const requestOptions = {
          method: 'GET',
          headers: headers,
      };
  
      return fetch("/.auth/me", requestOptions) 
          .then(parseResponseAndHandleErrors)
          .catch(error =&gt; {
              console.error(error)
          });
  }
  </code></pre>
  
  <p>I think I must be missing a cookie or a header in the GET but the docs don't give much information: <a href="https://docs.microsoft.com/en-us/azure/app-service/app-service-authentication-how-to#retrieve-tokens-in-app-code" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/app-service/app-service-authentication-how-to#retrieve-tokens-in-app-code</a></p>
  
  <blockquote>
    <p>From your client code (such as a mobile app or in-browser JavaScript), send an HTTP GET request to /.auth/me. The returned JSON has the provider-specific tokens.</p>
  </blockquote>
  
  <p>I have tried setting <code>'credentials': 'same-origin'</code> but that didn't make any difference.</p>