Missing OAuth user token but token is added to the header

I am sending a request using postman and everything works but when I replicate the same request in node.js then I get an error saying that oauth token is missing.

Error I am getting:

  error: 'Unauthorized',
  status: 401,
  message: 'Missing User OAUTH Token'

Headers I am sending:

  config: {
    url: 'https://api.twitch.tv/helix/clips?broadcaster_id=51496027&started_at=2020-12-05T00:00:00Z&ended_at=2020-12-05T00:00:00Z',
    method: 'post',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/x-www-form-urlencoded',
      Authorization: 'Bearer <acutal token>',
      'client-id': '<my id>',
      'User-Agent': 'axios/0.21.0'
    },

Code which is creating errors:

this.axios({
      method: 'post',
      url: `${this.url}broadcaster_id=${broadcasterId}&started_at=${startedAt}&ended_at=${endedAt}`,
      headers: {
        Authorization: 'Bearer <actual token>',
        'client-id': '<actualid>'
      }
    })
      .then((res) => {
        console.log(res);
      })
      .catch((err) => {
        console.log(err);
      });

Any ideas what I am missing?

That would suggest you made this request with an “App Access Token” aka “Client Credentials”

Instead of a “user access token”

You used the wrong kind of authentication token

Create Clip

Requires a token that ID’s a user. The token you used has no user attached to it, a a user is needed to “own” the clip.

1 Like

Thank you for help. I wanted to get clips not create clips but I didn’t notcie that I was sending POST requests. So in my case I just have to change from POST to GET because “app access token” works for getting clips.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.