I know there are existing discussions on this topic, but I was not able to find an answer to my situation: I want to pass credentials directly through the URL (following the https://user:pass@url scheme). I get a 401 error with this code:
final RestTemplate restTemplate = new RestTemplate();
final ResponseEntity<String> wsCalendarResponse = restTemplate.getForEntity("https://user:pass@foobarbaz.com", String.class);
If i copy.paste the exact same URL in a browser (https://user:pass@foobarbaz.com
), it works fine.
Any clue, more simple than this answer: Basic authentication for REST API using spring restTemplate ?
Thanks