I am calling to a Rest API hosted in IIS (localhost) as in following code.
HttpPost request = new HttpPost("https://localhost/Identity/oauth/"+"token");
request.addHeader("content-type", "application/json");
request.addHeader("Accept", "application/json");
List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("username", "myuser"));
params.add(new BasicNameValuePair("password", "mypass"));
params.add(new BasicNameValuePair("grant_type", "password"));
request.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse result = httpClient.execute(request);
But it is giving following error.
hostname in certificate didn't match:
What I did wrong in this calling to HTTPS? The HTTP call is working fine though.
Thank you.