String auth = "Basic ".concat(new String(Base64.encodeBase64(settings.getOauthKey().concat(":")
.concat(settings.getOauthSecret()).getBytes())));
Builder builder = client.resource(settings.getAccessTokenEndPoint()).header(AUTHORIZATION, auth)
.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE);
OutBoundHeaders headers = getHeadersCopy(builder);
ClientResponse clientResponse = builder.post(ClientResponse.class, formData);
String json = IOUtils.toString(clientResponse.getEntityInputStream());
HashMap map = mapper.readValue(json, HashMap.class);
settings.setStep("step3");
settings.setAccessToken((String) map.get("access_token"));
modelMap.put(SETTINGS, settings);
modelMap.put(
"requestInfo",
"Method: POST".concat(BR).concat("URL: ").concat(settings.getAccessTokenEndPoint()).concat(BR)
.concat("Headers: ").concat(headers.toString()).concat(BR).concat("Body: ").concat(formData.toString()));
addResponseInfo(modelMap, clientResponse);
modelMap.put("rawResponseInfo", json);
return "oauth-client";
}