title: Send the JWT header from MVC To Api controller
body: <p>I have web API generate JWT after login and post a new reservation and it works in Postman, now in MVC to consume web API using HttpClient, I can not send the authorized header with the session to api controller and validate it:</p>
  <pre><code>[HttpPost]
      public async Task&lt;IActionResult&gt; CreateReservation(ReservationViewModel reservation, string returnUrl)
      {
          HttpClient client = _guestApi.Initial();
          var contentType = new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;);
          client.DefaultRequestHeaders.Accept.Add(contentType);
  
          // Authorization header
          client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;Bearer&quot;,
              HttpContext.Session.GetString(&quot;token&quot;));
  
          HttpResponseMessage response = client.PostAsync(&quot;/api/Reservation/CreateReservation&quot;, null).Result;
          string stringData = response.Content.ReadAsStringAsync().Result;
          if (response.StatusCode == HttpStatusCode.Unauthorized)
          {
              ModelState.Clear();
              ModelState.AddModelError(&quot;Error&quot;, &quot;Unauthorized&quot;);
          }
          else
          {
              ModelState.AddModelError(&quot;Sucess&quot;, &quot;Successful Reservation Will Contact you Soon&quot;);
            
          }
          return View();
  </code></pre>
  <p>Api controller :</p>
  <pre><code>[HttpPost]
      [Route(&quot;CreateReservation&quot;)]
      public async Task&lt;IActionResult&gt; Reservation([FromBody] Reservation reservation )
  
      { 
          if (!ModelState.IsValid)
              return BadRequest(&quot;Not a vailable&quot;);
         
          // Create a new Reservation
          reservation = new Reservation()
           {
              GuestName = reservation.GuestName,
              GuestsNumber = reservation.GuestsNumber,
              Menu = reservation.Menu,
              Notes = reservation.Notes,
          };
          _context.Reservations.Add(reservation);
          await _context.SaveChangesAsync();
  
           return CreatedAtAction(&quot;GetReservation&quot;, new { id = reservation.Id }, reservation);
        
      }
  </code></pre>
  <p>How I can send the JWT header from MVC To Api controller and validate it ?</p>