411 Content-length Required
I am trying to do a POST using the Android Apache HttpClient but it is returning error 411 Content-Length Required. Here is the code. HttpClient httpClient = new Defaul
Solution 1:
Try this,
HttpClient httpClient = new DefaultHttpClient();
HttpPost request = new HttpPost("https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice");
request.setHeader("Content-type", "application/json");
request.setHeader("Accept", "application/json");
request.addHeader("Authorization", "Basic " + Base64.encodeToString((appId + ":" + appSecret).getBytes(), Base64.DEFAULT));
JSONObject obj = new JSONObject();
obj.put("grant_type", "authorization_code");
obj.put("code", code);
obj.put("scope", "https://uri.paypal.com/services/paypalhere");
request.setEntity(new StringEntity(obj.toString(), "UTF-8"));
HttpResponse response = httpClient.execute(request);
Post a Comment for "411 Content-length Required"