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?