Hi everyone!
I’m currently working on a React web app where I want to show the latest 3 clips from twitch. (i’m fairly new to react and axios so this web app is just for practice).
Note: The broadcaster_id & id in the params are id’s i grabbed from the internet somewhere, I’m not sure where to find the propper ones.
Here is my code:
const twitchUrl = "https://api.twitch.tv/helix/clips?id=AwkwardHelplessSalamanderSwiftRage";
try {
let res = await axios({
url: twitchUrl,
params: {"broadcaster_id":"141981764","id":"1woowvbkiNv8BRxEWSqmQz6Zk92", "first":"3"},
method: 'get',
timeout: 8000,
headers: {
'client-id': client_id,
'accept': 'application/vnd.twitchtv.v5+json',
'Authorization': 'Bearer ss91pf4relwcgcet6ebubt4sgo268o',
}
})
if(res.status === 200) {
console.log("twitch status: ", res.status)
}
return getTwitchClips(res.data);
}
catch(err) {
console.error("twitch error: ", err);
}
}
When I check the console log, it returnes this error:
AxiosError {message: 'Request failed with status code 401', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}
I don’t know what i’m doing wrong here, can someone please help me out with this ?
Thanks!