title: Twitch Helix API: Invalid OAuth Token Error
body: <p>I am using the <a href="https://dev.twitch.tv/docs/api" rel="nofollow noreferrer">Twitch Helix API</a> and creating an open source <a href="https://deno.land/" rel="nofollow noreferrer">Deno module</a>.  I have been trying to test out the API, but whenever I send fetch requests, it returns the following:</p>
  <pre><code>{
      &quot;error&quot;: &quot;Unauthorized&quot;,
      &quot;status&quot;: 401,
      &quot;message&quot;: &quot;Invalid OAuth token&quot;
  }
  </code></pre>
  <p>Here is what I am using within my code for the requests:</p>
  <pre><code>await fetch(`https://api.twitch.tv/helix/users?login=${login}`, {
    headers: {
      &quot;Client-ID&quot;: this.apiData.clientId,
      Authorization: `OAuth ${this.apiData.clientSecret}`,
    },
  });
  </code></pre>
  <p>I got my API Client ID and Client Secret from the <a href="https://dev.twitch.tv/console" rel="nofollow noreferrer">Twitch Developers Console</a> page for my app.  Here are the two keys that I am using:</p>
  <p><a href="https://i.stack.imgur.com/oElPi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oElPi.png" alt="enter image description here" /></a></p>
  <p>The code is executed using <code>deno run --allow-net file.ts</code>  Do you think that I need to do something else to make sure the request_url is equal to <code>http://localhost</code> for this to be able to work?  Also, is it that I need to get a different api key to be able to do this?  I also know that my Client ID and Client Secret are correct.  I have refreshed them three times already and put the tokens back in and it still doesn't work.</p>
  <p>Please help me figure out what I am doing wrong.  Thank you very much for your help!</p>
  <p>Check out the <a href="https://discuss.dev.twitch.tv/t/twitch-helix-api-invalid-oauth-token-error/28036" rel="nofollow noreferrer">Twitch Discussion issue for this here!</a></p>