LOG.debug("Obtaining user profile. Profile URL : " + url);
Response serviceResponse = null;
try {
serviceResponse = authenticationStrategy.executeFeed(url);
} catch (Exception e) {
throw new SocialAuthException(
"Failed to retrieve the user profile from " + url, e);
}
if (serviceResponse.getStatus() != 200) {
throw new SocialAuthException(
"Failed to retrieve the user profile from " + url
+ ". Staus :" + serviceResponse.getStatus());
}
String result;
try {
result = serviceResponse
.getResponseBodyAsString(Constants.ENCODING);
LOG.debug("User Profile :" + result);
} catch (Exception exc) {
throw new SocialAuthException("Failed to read response from "
+ url, exc);
}
try {
JSONObject pRes = new JSONObject(result);
JSONObject pObj = pRes.getJSONObject("main");