Why does my raid request twitch api doesnt work?

Here is the Way I get the token:

export const getToken = async () => {
  let token;

  try {
    token = await axios.post(

  } catch (error) {

  return token.data.access_token;

and here is the way how I try to raid

  try {
    const raid = await axios.post(
        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

what the body message of the response?

HTTP code is only half the information.
You should get a JSON body which describes the error

This is the wrong token type.

You have generated a “server token” which doesn’t represent a user.
Then tried to perform a task on behalf of a user.

You need a user token

From - Reference | Twitch Developers

### Authorization

Requires a user access token that includes the **channel:manage:raids** scope. The ID in the `from_broadcaster_id` query parameter must match the user ID in the OAuth token.

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