This is a stupid question but this is the CDN version right?
<script src="https://ttv-api.s3.amazonaws.com/twitch.min.js"></script>
I’ve downloaded the Twitch SDK straight off of github from the repository, but using this downloaded version of twitch.min.js with the same code, I actually am logged out of my authenticated session with twitch and have to re-connect/re-authenticate on my webpage.
Looking at the Makefile, it seems that everything is already built. I don’t have to make the project myself do I? I do have docco & UglifyJS installed on my computer but like I said, it looks like everything’s good to go.
Here’s my code just for reference:
function follow(channel)
{
var success = function()
{
// Change color of button to green and change 'Follow' to 'Followed'
document.getElementById("follow-button").innerHTML = "Followed";
document.getElementById("follow-button").className = "btn btn-success btn-lg btn-block";
document.getElementById("follow-button").removeAttribute("onclick");
}
var failure = function(step)
{
// Popup saying 'Something broke, make sure you're logged into twitch.'
var token = Twitch.getToken();
window.alert("Something went wrong at step: " + token);
}
Twitch.getStatus(function(error, status)
{
if(error) return failure("1");
if(!status.authenticated) return failure("-1");
Twitch.api({method: 'user'}, function(error, user)
{
if(error) return failure("2");
Twitch.api({method: '/users/' + user.name + '/follows/channels/' + channel, verb: 'PUT'}, function(error, response)
{
if(error) return failure(user.name);
success();
});
});
});
}