Here is the Way I get the token:
export const getToken = async () => {
let token;
try {
token = await axios.post(
`https://id.twitch.tv/oauth2/token?client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&grant_type=client_credentials`
);
console.log(token.data);
} catch (error) {
console.log(error);
}
return token.data.access_token;
};
and here is the way how I try to raid
try {
const raid = await axios.post(
`https://api.twitch.tv/helix/raids?from_broadcaster_id=${MY_ID}&to_broadcaster_id=${MY_TARGET}`,
{
headers: {
authorization: `Bearer ${token}`,
"client-id": CLIENT_ID,
},
}
);
console.log("raid result", raid);
} catch (error) {
console.log("Error when raiding =>", error);
}
The problem is I got a 401 error. My token is good, no problem, it works fine for others requests. I used my id in from_broadcast_id which is the same account i got the token oauth.
But it doesnt work and I can’t figure it out. The doc is there, I check every point about why it couldnt work : Raids | Twitch Developers
Thanks for help