oauth/token request manual
ResponseEntity<String> response = null; RestTemplate restTemplate = new RestTemplate(); String credentials = "clientId:clientSecret"; String encodedCredentials = new String(Base64.encodeBase64(credentials.getBytes())); // System.out.println(username); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); headers.add("Authorization", "Basic " + encodedCredentials); HttpEntity<String> request = new HttpEntity<String>(headers); String accessTokenUrl = "http://localhost:8080/api/oauth/token" + "?grant_type=password" + "&username=username" + "&password=password" + "&scope=read write"; response = restTemplate.exchange(accessTokenUrl, HttpMethod.POST, request, String.class); // System.out.println(response.getBody().split(",")[0].spl