Http Post in laravel using fetch api giving TokenMismatchException
<p>I am trying to make a http post using fetch api. Even though I am sending the token, I am getting error <strong>TokenMismatchException in VerifyCsrfToken.php</strong> . How can I make the call using fetch api? (I also tried with jQuery ajax and its working perfectly)  Heres the fetch api code </p>

<pre><code>      var URL = $("#form").attr("action");
      var token = $("input[name='_token']").val();
      var group_id = $(this).val();
  fetch(URL, {
       method: 'post',
       mode: 'no-cors',
       body: JSON.stringify({
           'csrf-token': token,
           'group_id': group_id
       })
     }).then(function(response){
           return response.json();
       })  .then(function(json){



       })
         .catch(function(error){


         });
</code></pre>

<p>I have added token in form like this </p>

<pre><code>&lt;form id="form" action="{{ url('api/getcoursebygroup') }}"&gt;
    &lt;input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" /&gt;
  &lt;/form&gt;
</code></pre>

<p>This jQuery ajax call is working fine :</p>

<pre><code>$.ajax({
          type: "POST",
          url:  URL,
          data: { "group_id" : group_id, "_token" : token },
          dataType: 'json'
      }).done(function (result) {

        if(result.code == 1){



        }


      });
</code></pre>

<p>jQuery ajax call headers </p>

<p><a href="https://i.stack.imgur.com/JyDDU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JyDDU.png" alt="enter image description here"></a></p>

<p>Fetch api call headers</p>

<p><a href="https://i.stack.imgur.com/nnukp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nnukp.png" alt="enter image description here"></a></p>