Hi folks,
I have searched and searched but I hit a wall and I am probably missing something but I cannot get it to work.
I have made an interface to twitch, most calls work without issues (clip creation, setting markers) but those are all helix endpoints.
The start commercial endpoint is only on kraken (v5?) but I keep getting a authorization failed error. I use the same tokens as with the others but somehow for this it does not work.
I used the example in the documentation and I have added all headers but still it is not working.
Code:
String url = “https://api.twitch.tv/kraken/channels/” + getUserId() + “/commercial”;
URL myurl = new URL(url);
HttpsURLConnection con = (HttpsURLConnection) myurl.openConnection();
con.setRequestProperty (“Authorization”, "Oauth " + getAccessToken());
con.setRequestProperty(“Content-Type”, “application/json”);
con.setRequestProperty(“Accept”, “application/vnd.twitchtv.v5+json”);
con.setRequestProperty(“Client-ID”, CLIENTID);
con.setDoOutput(true);
con.setRequestMethod(“POST”);
So all the user values (getUserId(), getAccessToken() and CLIENTID) function properly with all the other calls.
If i understand the docs correctly, the same authorization should work for the kraken as well.
Hope someone has somem insights for me.
Thanks in advance
EDIT: also the auth string with scopes:
String url = “https://id.twitch.tv/oauth2/authorize”
+ “?client_id=” + CLIENTID
+ “&redirect_uri=” + CALLBACK_URL
+ “&response_type=token”
+ “&scope=chat:edit channel:moderate channel_commercial clips:edit user:edit:broadcast”;