Hi there!
First time posting on this forum, however been using it a lot recently.
I am trying to create a custom points reward programmatically(need to be able to refund points using my application)
I am already using OAuth token for reading information about rewards redeemed(so it is not expired) and have been using a valid client ID as well
let url = "https://api.twitch.tv/helix/channel_points/custom_rewards?broadcaster_id=" + channelID;
let authToken = authenticationToken;
let clientID = clientId;
//creating normal attack reward
$.ajax({
url: url,
method: "POST",
headers: {
"Client-ID": clientID,
"Authorization": "OAuth " + authToken
},
data: {
"title": "Attack",
"cost": 30
} }).done(function(user) {
console.log("Attack rewards was created");
});
Have been using this code to send the request and I get a 401 error back
I assume it might be one of two issues
→ the broadcaster_id at the end of the URL (that is my channel ID that I entered)
→ the data attached to the POST request (I could not find an example of post request with data, so am unsure if I am doing it correctly)