Relative Content

Tag Archive for javaapachehttp-post

how to set grant_type in apache client HttpPost

List<NameValuePair> postParameters = new ArrayList<>(); HttpPost httpPost = new HttpPost(“http://example.com”); postParameters.add(new BasicNameValuePair(“grant_type”, “client_credentials”)); httpPost.setEntity(new UrlEncodedFormEntity(postParameters, “UTF-8”)); httpPost.setHeader(“HttpHeaders.AUTHORIZATION”, “Basic “+base64encoded); httpPost.setHeader(“Content-Type”, “application/x-www-form-urlencoded”); tokenApiResponse = this.httpClient.execute(httpPost); LOGGER.log(Level.INFO,”Token response:{0}”,tokenApiResponse.getStatusLine().getStatusCode()); Iam getting 401 unauthorized as status code. Can someone please review the way I’m setting grant_type into HttpPost request. I’m being little skeptical there. In linux, below is the […]

how to set grant_type in apache client HttpPost

List<NameValuePair> postParameters = new ArrayList<>(); HttpPost httpPost = new HttpPost(“http://example.com”); postParameters.add(new BasicNameValuePair(“grant_type”, “client_credentials”)); httpPost.setEntity(new UrlEncodedFormEntity(postParameters, “UTF-8”)); httpPost.setHeader(“HttpHeaders.AUTHORIZATION”, “Basic “+base64encoded); httpPost.setHeader(“Content-Type”, “application/x-www-form-urlencoded”); tokenApiResponse = this.httpClient.execute(httpPost); LOGGER.log(Level.INFO,”Token response:{0}”,tokenApiResponse.getStatusLine().getStatusCode()); Iam getting 401 unauthorized as status code. Can someone please review the way I’m setting grant_type into HttpPost request. I’m being little skeptical there. In linux, below is the […]

how to set grant_type in apache client HttpPost

List<NameValuePair> postParameters = new ArrayList<>(); HttpPost httpPost = new HttpPost(“http://example.com”); postParameters.add(new BasicNameValuePair(“grant_type”, “client_credentials”)); httpPost.setEntity(new UrlEncodedFormEntity(postParameters, “UTF-8”)); httpPost.setHeader(“HttpHeaders.AUTHORIZATION”, “Basic “+base64encoded); httpPost.setHeader(“Content-Type”, “application/x-www-form-urlencoded”); tokenApiResponse = this.httpClient.execute(httpPost); LOGGER.log(Level.INFO,”Token response:{0}”,tokenApiResponse.getStatusLine().getStatusCode()); Iam getting 401 unauthorized as status code. Can someone please review the way I’m setting grant_type into HttpPost request. I’m being little skeptical there. In linux, below is the […]