@Dist I’m still getting the “Invalid OAuth token” error, I’m running a script that gets the accesstoken:
async function getTwitchAccessToken() {
const twitchTokenUrl = `https://id.twitch.tv/oauth2/token?client_id=${twitch_client_id}&client_secret=${twitch_client_secret}&grant_type=client_credentials`;
axios.post(twitchTokenUrl).then((response) => {
const token = response.data.access_token;
setTwitchAccessToken(token);
}).catch(({response}) => {
console.log("error post: ", response)
});
}
This does return a accessToken, that token, is the Bearer code right ? Or am i wrong about this?
Because i’m using that in the other codes to get the user and the clips:
User:
const twitchUserUrl = "https://api.twitch.tv/helix/users";
axios.get(twitchUserUrl, {
headers: {
'Client-Id': twitch_client_id,
'Authorization': `Bearer ${twitchAccessToken}`,
}
}).then((response) => {
console.log("user resp: ", response)
}, (err) => {
console.log("user error: ", err);
});
Clips:
const twitchClipsUrl = "https://api.twitch.tv/helix/clips";
axios({
url: twitchClipsUrl,
params: {"broadcaster_id":"67955580", "first":"3"},
method: 'get',
timeout: 8000,
headers: {
'Client-Id': twitch_client_id,
'Authorization': `Bearer ${twitchAccessToken}`,
}
}).then((response) => {
console.log("twitch status: ", response.status)
}, (error) => {
console.log("clips errpr: ", error)
})
What am i missing here ? (Yes I am new to all of this, so if its something stupid, bear with me haha)