So I have two bot applications; one for testing and one in use. The one in use suddenly stopped working + it cannot start anymore. On startup, I receive error 401 (unauthorized). Now the curious thing is that my bot for testing purposes receives a 400 bad request. They have identical code but different secrets and IDs of course. Is something wrong with the servers or did i just miss something? I did not change my code for a while now, yet it stopped working now.
Just in case: I’m using this request
POST https://id.twitch.tv/oauth2/token
?grant_type=refresh_token
&refresh_token=<refresh_token>
&client_id=<client_ID>
&client_secret=<client_secret>
And my code for it is this
axios({
url: 'https://id.twitch.tv/oauth2/token?grant_type=refresh_token',
params: {
refresh_token: refreshtoken,
client_id: clientID,
client_secret: clientSecret,
},
method: 'POST',
responseType: 'json'
})
.then(response => {
if(typeof response === 'undefined'){
console.log("!!! ERROR: Response undefined! Probably lost connection. Waiting...");
return;
}
//printResponseData(response);
let body = response.data;
if(body)
callback(body["access_token"], body["refresh_token"]);
else
console.log("Could not refresh token.");
})
.catch(err => {
if(err) console.log(err);
})
.finally(() => {});