I'm trying to access an image through a url. The problem is I have to be authenticated via a session id to access the image. I'm trying to get authenticated but I'm getting a 403. Also, how would I add my session id and other information after being authenticated to grab the input stream of the image? Here is my attempt:
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("https://cloud.openalpr.com/account/login/");
List<NameValuePair> form = new ArrayList<>();
form.add(new BasicNameValuePair("username","user"));
form.add(new BasicNameValuePair("password", "password"));
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, Consts.UTF_8);
httpPost.setEntity(entity);
httpPost.setHeader("Content-type", "application/x-www-form-urlencoded");
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X ...");
CloseableHttpResponse response = httpClient.execute(httpPost);