0

I am trying to retrieve token from WSO2 identity server, based upon the username and password received from UI.

I am able to do it from the below curl command:

curl -v -k -X POST --basic -u zbvliQjZK2aVpWV_EE2Q6PWYDUIa:xBGfoppV1DsDGoMNHDPsF5uWLKga -d "grant_type=client_credentials" https://localhost:9443/oauth2/token

But I am trying to do it through rest api using spring resttemaplte. Is it possible to do it? I hope yes.

krmanish007
  • 6,749
  • 16
  • 58
  • 100
  • can't you have client call? – Thusitha Thilina Dayaratne Jan 13 '17 at 10:53
  • Hi, sorry, I didn't get your point. do you mean there is some client available to call? I am trying something like that: HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.add("basic", encodedUsername+":"+encodedPassword); HttpEntity request1 = new HttpEntity<>(headers); restTemplate.postForObject("https://localhost:9443/oauth2/token", request1, String.class); – krmanish007 Jan 13 '17 at 11:19
  • Did you check with apache http client? – Thusitha Thilina Dayaratne Jan 14 '17 at 02:49

0 Answers0