Http://api.twitch.tv/api/viewer/token.json is not working?

Just FYI, only APIs that start with https://api.twitch.tv/kraken/ are supported. All others are subject to change or removal without notice. I would recommend using one of the OAuth flows shown in the documentation.