I'm writing a client for REST API using cookie-based authentication.
Here's the code:
HttpHeaders headers = new HttpHeaders();
headers.add("Cookie", auth_cookie);
HttpEntity<?> request = new HttpEntity<>(headers);
ResponseEntity<String> response = restTemplate.exchange(URL, HttpMethod.GET, request, String.class);
which results in 401 Unauthorized.
The same approach with POST works fine, the same request when using basic authentication is also fine. What could be the problem?