If you are getting a 401 error, it is most likely that your token is invalid, or that you aren’t sending the token properly for some reason. Assuming your wrapper is used by other people and not buggy, it’s reasonable that your token is not valid, or does not possess the scopes required to update channel information.
You can check if an oauth token is valid and what scopes it has by GETting https://api.twitch.tv/kraken/?oauth_token=TOKEN. Updating channel status and game requires the channel_editor scope.