JS Follow button API error

Thnx! I used that CDN. I’ll take a look at the latest SDK

EDIT:
So now I added the token and required scope, gave my account the permissions but it keeps giving this error:

[Twitch] API Error: Unauthorized; Token invalid or missing required scope

Then when i check the token through https://api.twitch.tv/kraken/user/?oauth_token= it confirms the user that has logged in. And i’m sure i’m using the correct scope within Twitch.login

scope: ['user_read', 'user_subscriptions', 'user_follows_edit']

altered function:
(token is called after login → var token = Twitch.getToken():wink:

$scope.follow = function() {
        var failure = function (error) {
            console.log("failure: " + error)
        };

        Twitch.getStatus(function (error, status) {
            if (error) return failure(error.message + "(1)");
            if (!status.authenticated) return failure(error.message);

            Twitch.api({method: 'user'}, function (error, user) {
                if (error) return failure(error.message + "(2)");

                if($scope.followed) {

                    Twitch.api({verb: 'DELETE', method: 'users/' + user.name + '/follows/channels/' + channel + '?oauth_token=' + token}, function (error, response) {
                        if (error) return failure(error.message + "(3)");
                        return $scope.$apply($scope.followed = false);
                    });
                }
                else {
                    Twitch.api({verb: 'PUT', method: 'users/' + user.name + '/follows/channels/' + channel + '?oauth_token=' + token}, function (error, response) {
                        if (error) return failure(error.message + "(4)");
                        return $scope.$apply($scope.followed = true);
                    });
                }
            });
        });
    };

Is there something i’m missing here?