Must provide a valid Client-ID or OAuth token || Axios Request

Using Node.js Axios to POST data to subscribe to an event topic for a webhook, checking whether a stream is currently live or not. Unfortunately, i’m having trouble using Axios to post the data properly, I have used postman with the exact same data and it actually worked. However, whenever I try it within my app the request fails every time saying that “Must provide a valid Client-ID or OAuth token”.

axios.post(‘https://api.twitch.tv/helix/webhooks/hub’, {
headers:{
“Client-ID”: ‘yc2lufpq2r85em1h1dyzgtotm92zdx’,
},
data:{
“hub.callback”: ‘https://yohane.date/twitch’,
“hub.mode”: ‘subscribe’,
“hub.topic”:‘https://api.twitch.tv/helix/streams?user_id=129454141’,
}
}).then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});

I’m really not sure what im doing wrong, i’ve read the Axios documentation and it said to use headers for header data, and data for the body data. Any help would be really appreciated at this point.

codes

1 Like

Yes this worked! Cheers dude.

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