i actually created the OAuth token using the guide, i used my virtual machine for create it, after, i used this code for see if the code work or not. (spoiler, don’t work…)
private static boolean validateOAuthToken() {
try {
OkHttpClient client = new OkHttpClient();
// Crea una richiesta API che richieda l'autorizzazione del token
Request request = new Request.Builder()
.url("https://api.twitch.tv/helix/users")
.header("Client-ID", "YOUR_TWITCH_CLIENT_ID") //i tried with my name and after with // ID client
.header("Authorization", "Bearer " + OAUTH_TOKEN)
.build();
Response response = client.newCall(request).execute();
int statusCode = response.code();
return statusCode == 200;
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
EVERY time error 401…