title: How to set Httpwebrequest Authentication header with Authenticationresult
body: <p>I need to set the auth header for my http web request using the AuthenticationResult I get from AuthenticationContext:</p>
  
  <pre><code> AuthenticationContext authContext = new AuthenticationContext("http://blabla/token");
  
   Task&lt;AuthenticationResult&gt; resultTask = authContext.AcquireTokenAsync(
                 "http://blabla/service",
                 "SomeGuid",
                 new Uri("http://authlogin"),
                 new Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformParameters(PromptBehavior.Auto, false));
  
   resultTask.Wait();
   AuthenticationResult result = resultTask.Result;
   HttpWebRequest request = WebRequest.CreateHttp("http://MyApi/method");
   //Set headers for request
  </code></pre>
  
  <p>I need to pass the authentication result to the header of my request. I know I can do</p>
  
  <pre><code>request.Headers[HttpRequestHeader.Authorization] = //something
  </code></pre>
  
  <p>I just don't know what that something should be. Any help is appreciated. Thanks</p>