title: HttpClient PostAsync returns 500 when getting token
body: <p>I am trying to figure out what I can do (logging, things to check) before having to read server logs as I don't want to miss something stupid before requesting that.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>const string URL = "https://SomeURL/api/security/";
  string urlParameters = string.Format("grant_type=password&amp;username={0}&amp;password={1}", username, password);
  StringContent content = new StringContent(urlParameters, Encoding.UTF8, "application/x-www-form-urlencoded");
  
  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
  
  HttpClient client = new HttpClient();
  client.BaseAddress = new Uri(URL);
  StringContent content = new StringContent(urlParameters, Encoding.UTF8, "application/x-www-form-urlencoded");
  
  var tokenResponse = client.PostAsync("token", content).Result;
  </code></pre>
  
  <p>I am a little newer to this so I'm not sure what to check next but have tried the same request using postman and get a response with my token so it looks like I am missing something or maybe formatting something incorrectly?</p>