diff --git a/src/main/java/io/github/jhipster/registry/security/oauth2/OAuth2ClientCredentialsService.java b/src/main/java/io/github/jhipster/registry/security/oauth2/OAuth2ClientCredentialsService.java index bd3833a4a..5c315ff00 100644 --- a/src/main/java/io/github/jhipster/registry/security/oauth2/OAuth2ClientCredentialsService.java +++ b/src/main/java/io/github/jhipster/registry/security/oauth2/OAuth2ClientCredentialsService.java @@ -63,7 +63,8 @@ private void retrieveNewAccessToken() { map.add("grant_type", "client_credentials"); HttpEntity requestEntity = new HttpEntity<>(map, headers); - ResponseEntity responseEntity = this.restTemplate.exchange("http://UAA/oauth/token", HttpMethod.POST, requestEntity, DefaultOAuth2AccessToken.class); + String uaaServiceId = jHipsterProperties.getSecurity().getClientAuthorization().getTokenServiceId(); + ResponseEntity responseEntity = this.restTemplate.exchange("http://" + uaaServiceId + "/oauth/token", HttpMethod.POST, requestEntity, DefaultOAuth2AccessToken.class); if (!responseEntity.getStatusCode().is2xxSuccessful()) { //TODO diff --git a/src/main/resources/config/application-uaa.yaml b/src/main/resources/config/application-uaa.yaml index 29ced10a7..64a7dd1f0 100644 --- a/src/main/resources/config/application-uaa.yaml +++ b/src/main/resources/config/application-uaa.yaml @@ -1,9 +1,10 @@ jhipster: security: client-authorization: + token-service-id: uaa client-id: internal client-secret: internal eureka: client: - fetch-registry: true \ No newline at end of file + fetch-registry: true