title: How do I use the IGDB api with the fetch method of js to authenticate the user-key?
body: <p>this is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>fetch("https://api-2445582011268.apicast.io/games/",{
   method: 'GET',
   headers: {
    'user-key':'key',
    'Accept': 'application/json'
   }
  })
  .then(resp =&gt; resp.json())
  .then(json =&gt; {
   console.log('json',json)
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I try to bring the data with the fetch I get the following error:</p>
  
  <p>Response to preflight request doesn't pass access control <code>check: No 'Access-Control-Allow-Origin'</code> header is present on the requested resource. Origin .</p>
  
  <p>and when I add <code>"mode: 'no-cors'"</code> it resolves
  and tried also to add the Access-Control-Allow-Origin but it did not fit anything, follow the same errors</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>fetch("https://api-2445582011268.apicast.io/games/",{
   method: 'GET',
   mode: 'no-cors', //here was added: mode:'no-cors '
   headers: {
    'user-key':'key',
    'Accept': 'application/json'
   }
  })
  .then(resp =&gt; resp.json())
  .then(json =&gt; {
   console.log('json',json)
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p>the independent if I add or not the <code>mode: cors</code>, I always get the following </p>
  
  <pre><code>error:
  Authentication parameters missing
  OPTIONS 403 (Forbidden)
  </code></pre>
  
  <p>Any idea of why?</p>
  
  <p>Thanks in advance!</p>