this.config = config;
}
public Token getAccessToken(Token requestToken, Verifier verifier)
{
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
if(requestToken != null) {
request.addOAuthParameter(OAuthConstants.TOKEN, requestToken.getToken());
request.addOAuthParameter(OAuthConstants.VERIFIER, verifier.getValue());
}
request.addBodyParameter("x_auth_username", api.getUsername());
request.addBodyParameter("x_auth_password", api.getPassword());
request.addBodyParameter("x_auth_mode", "client_auth");
addOAuthParams(request, requestToken);
addSignature(request);
Response response = request.send();
String body = response.getBody();
return api.getAccessTokenExtractor().extract(body);
}