Ty very much IllusionaryOne for all the replies!! I have everything more clear now.
A summary for AidanWilliams (or however need it), and correct me if Im doing something wrong:
1. First I have to authorize the aplication with this url
2. When I accept the permissions I receive a GET request with the parameters code and scope on the redirect_uri that I gave in the first step (exactly the same one that you put when you registered your app), then I use them on this request:
var urlToken = “https://id.twitch.tv/oauth2/token?client_id=” + CLIENTID_TWITCH + “&client_secret=” + CLIENT_SECRET + “&code=” + CODE + “&grant_type=authorization_code” + “&redirect_uri=http://localhost/authenticate”;
request ({ url : urlToken , method: "POST" }, function (err, res, body) { console.log(body); });
Here I get in the **body** the access_token, refresh_token and scope parameters. (It seems that this access_token never expire because we have to set the expiration time, but I dont know how to do it already).
3. And now with that token you can authorize your request for the sub list like this:
var url = “https://api.twitch.tv/kraken/channels/_**yourchannel**_/subscriptions”;
request ({
url : url,
method: “GET”,
json: true,
headers : {
“Client-ID”: clientIdTwitch,
“Authorization”: “OAuth yourAccessToken” //this is what I was failing at start
}
}, function (err, res, body) {
console.log(body); //Here you have an object with yours subs in this case.
});
Again, thanks to IllusionaryOne for the answers ![]()
![]()