Skip to content

Commit

Permalink
update to avoid loop on unauthorize (#63)
Browse files Browse the repository at this point in the history
* update to avoid loop on unauthorize

* update condition for the status check
  • Loading branch information
ndduc01 authored Jan 27, 2025
1 parent 91cbb8d commit 59c714c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
Expand Down Expand Up @@ -37,5 +38,8 @@ private String fetchNewToken() {
HttpEntity<String> entity = new HttpEntity<>(headers);

ResponseEntity<String> response = restTemplate.postForEntity(tokenEndpoint, entity, String.class);
if (response.getStatusCode() != HttpStatus.OK) {
System.exit(0);
}
return response.getBody(); }
}

0 comments on commit 59c714c

Please sign in to comment.