I’m following the documentation from Prediction | Twitch Developers So I created an application and with it’s client id and secret I’m redirecting the user to login at:
With the corresponding client id and redirect url.
With the response I request an access token by doing a POST to: https://id.twitch.tv/oauth2/token?client_id=TW_CLIENT_ID&client_secret=TW_CLIENT_SECRET&code=CODE&grant_type=authorization_code&redirect_uri=CB_URL
with the CODE been the code received in the previous step.
With this access token I then do a POST like this (REST Client)
POST https://api.twitch.tv/helix/predictions
Authorization: Bearer {{token}}
Client-Id: {{clientId}}
Content-Type: application/json
{
"broadcaster_id": "___",
"title": "Test prediction",
"outcomes": [{ "title": "Option 1" }, { "title": "Option 2" }],
"prediction_window": 300
}
ClientId is my application client id and token is the access token we got in the previous steps. Broadcaster ID is the ID of the broadcaster account I’m a moderator for (maybe this is the key to the issue) When sending this post I get back.
{
"error": "Unauthorized",
"status": 401,
"message": "The ID in broadcaster_id must match the user ID found in the request's OAuth token."
}
I’m assuming that only a broadcaster himself can use this endpoint? But if that’s the case why it would even ask for a broadcaster id?
Is it not possible to a moderator to use this endpoint?