Skip to content

Commit

Permalink
fix(auth): clean up response body in isCredentialValid (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Aug 22, 2022
1 parent 6e704ea commit cbdf64f
Showing 1 changed file with 7 additions and 9 deletions.
Expand Up @@ -47,16 +47,14 @@ public Optional<Boolean> isCredentialValid(OAuth2Credential credential) {
if (credential == null || credential.getAccessToken() == null || credential.getAccessToken().isEmpty())
return Optional.of(false);

try {
// build request
Request request = new Request.Builder()
.url("https://id.twitch.tv/oauth2/validate")
.header("Authorization", "OAuth " + credential.getAccessToken())
.build();

// perform call
Response response = httpClient.newCall(request).execute();
// build request
Request request = new Request.Builder()
.url("https://id.twitch.tv/oauth2/validate")
.header("Authorization", "OAuth " + credential.getAccessToken())
.build();

// perform call
try (Response response = httpClient.newCall(request).execute()) {
// return token status
if (response.isSuccessful())
return Optional.of(true);
Expand Down

0 comments on commit cbdf64f

Please sign in to comment.