OAuthAccessor accessor = accessorInfo.getAccessor();
if (accessor.consumer.serviceProvider.accessTokenURL == null) {
throw responseParams.oauthRequestException(OAuthError.BAD_OAUTH_CONFIGURATION,
"No access token URL specified.");
}
Uri accessTokenUri = Uri.parse(accessor.consumer.serviceProvider.accessTokenURL);
HttpRequest request = new HttpRequest(accessTokenUri);
request.setMethod(accessorInfo.getHttpMethod().toString());
if (accessorInfo.getHttpMethod() == HttpMethod.POST) {
request.setHeader("Content-Type", OAuth.FORM_ENCODED);
}
List<Parameter> msgParams = Lists.newArrayList();
msgParams.add(new Parameter(OAuth.OAUTH_TOKEN, accessor.requestToken));
if (accessorInfo.getSessionHandle() != null) {
msgParams.add(new Parameter(OAuthConstants.OAUTH_SESSION_HANDLE,
accessorInfo.getSessionHandle()));
}
String receivedCallback = realRequest.getOAuthArguments().getReceivedCallbackUrl();
if (!StringUtils.isBlank(receivedCallback)) {
try {
Uri parsed = Uri.parse(receivedCallback);
String verifier = parsed.getQueryParameter(OAuthConstants.OAUTH_VERIFIER);
if (verifier != null) {
msgParams.add(new Parameter(OAuthConstants.OAUTH_VERIFIER, verifier));
}
} catch (IllegalArgumentException e) {
throw responseParams.oauthRequestException(OAuthError.INVALID_REQUEST,