Ok I read over the links you gave me Barry (thank you btw) and I tried setting up the call in different ways but am still getting a failure. I read the ajax post stuff but not exactly sure how that setup should look. I talked to my prof and he was less than helpful basically saying go Google it.
So here is what I got so far (and yes I know the whole key, secret thing but this is for a class project, its fine, I am not concerned about that)
function refreshToken (storeToken, data)
{
if(storeToken >= 120)
{
console.log("Token still valid for " , storeToken);
}
else{
console.log("Token is or soon to be expired. Time remaining " , storeToken);
return $.ajax({
url : "https://id.twitch.tv/oauth2/token",
type : "POST",
data : {
grant_type : "refresh_token",
refresh_token : data.refresh_token,
client_id : "HappyNewYear2019",
client_secret : "ISwearIHateJSSometimes",
},
success : constants.successTag,
error : () => {console.log("refresh failed ")},
})
}
}
I also am not too sure what response I am expecting to get back. Am I getting only a new access token or an access token and new refresh token? or the whole user object back?