The original token is one you can get yourself using a tool like This One Here. You use this token to get an “access token” but since it’s all public data you can just re-use the original token for your account to lookup info such as the channels endpoint without user-specific authentication.
I’ve included a Code Sample Below from one of my bots.
Twitch.prototype.authenticate = function (callback) {
const opts = {
url: 'https://id.twitch.tv/oauth2/validate',
headers: {
'Authorization': `Bearer ${<Original_OAuth_Token>}`,
'Client-ID': `${<Client ID>}` //Client-ID from your dev portal
}
};
request(opts, function (error, response, body) {
if (!error && response.statusCode == 200) {
const output = JSON.parse(body);
return callback(null, output);
} else (
console.log(`ERROR WITH AUTHENTICATE! ${response}`)
)
});
}
Twitch.prototype.channels = function (userID, callback) {
const that = this;
this.authenticate(function (err, output) {
const opts = {
url: `https://api.twitch.tv/helix/channels?broadcaster_id=${userID}`,
headers: {
'Authorization': `Bearer ${<Original_OAuth_Token>}`,
'Client-ID': `${output.client_id}` // New Client-ID
}
};
request(opts, function (error, response, body) {
if (!error && response.statusCode == 200) {
const info = JSON.parse(body);
return callback(null, info.data[0]);
} else (
console.log(response)
)
});
});
}