I need to retrieve a resources from my server by sending a GET request with the some Authorization headers using RestTemplate.
After going over the docs I noticed that
These days something like the following will suffice:
HttpHeaders headers = new HttpHeaders(); headers.setBearerAuth(accessToken); restTemplate.exchange(RequestEntity.get(new URI(url)).headers(headers).build(), returnType);