title: Xamarin csrf-token missing or incorrect using HttpClient
body: <p>I'm trying to run a post request with my Xamarin app. My backend is a Django app which allows all cross origin:</p>
  
  <pre><code>CORS_ORIGIN_ALLOW_ALL = True
  </code></pre>
  
  <p>There is no problem when I try to POST, PUT, GET, PATCH, DELETE with my Angular2 app, but when I try with my Xamarin app, my backend returns this error:</p>
  
  <pre><code>csrf token missing or incorrect
  </code></pre>
  
  <p>My Xamarin c# code looks like that:</p>
  
  <pre><code>namespace Services
  {
      public static class Authentication
      {
          public static async Task&lt;string&gt; Login(string email, string password)
          {
              var loginModel = new LoginModel() { email = email, password = password };
              Uri uri = new Uri(Environment.server_url + "rest-auth/login/");
              var json = JsonConvert.SerializeObject(loginModel);
              var content = new StringContent(json, Encoding.UTF8, "application/json");
              HttpResponseMessage response = null;
              using (var client = new HttpClient())
              {
                  response = await client.PostAsync(uri, content);
              }
              return await response.Content.ReadAsStringAsync();
          }
      }
  
      public class LoginModel
      {
          public LoginModel()
          {
          }
          public string email;
          public string password;
  
      }
  }
  </code></pre>
  
  <p>As you can see, there is no csrf-token added to the header because a don't know how to get this token with Xamarin.</p>
  
  <p>I've tried some random code like this one:</p>
  
  <pre><code>client.DefaultRequestHeaders.Add("x-csrf-token", "Fetch");
  </code></pre>
  
  <p>Or this one, with a random token just to see:</p>
  
  <pre><code>client.DefaultRequestHeaders.Add("x-csrf-token", "IYTN3eZvkah5vh4y0mEOzCHbbKPcutV4DiSKsbEnlgmuNkdu4jumYdaHYJqUT57n");
  </code></pre>
  
  <p>But as expected, it doesn't helps.</p>
  
  <p>I've tried to get the token via a get request but the response doesn't contains any token.</p>
  
  <p>Any idea ?</p>
  
  <p>I'm using the last version of Xamarin Forms (2.3.3.175).</p>