In the last step of the OAuth2 I'm getting an error 400, so my http request is probably not formatted properly.
I'm using java so I tried to turn the Curl command from the official documentation into an HttpPostRequest.
(Request access token: https://developer.box.com/reference#token)
curl https://api.box.com/oauth2/token \
-d 'grant_type=authorization_code' \
-d 'code=' \
-d 'client_id=' \
-d 'client_secret=' \
-X POST
Thats my current code for it and I'm not sure where my Mistake is..
HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost(url);
List params = new ArrayList(2);
params.add(new BasicNameValuePair("grant_type", "authorization_code"));
params.add(new BasicNameValuePair("code",code));
params.add(new BasicNameValuePair("client_id", ConfigAuth.client_id));
params.add(new BasicNameValuePair("client_secret", ConfigAuth.client_secret));
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
//Execute and get the response.
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
System.out.println(response);
Long story short, I get Error 400 and I don't understand why.