protected ArrayList<NameValuePair> buildParameters(OAuthParameters params) {
    ArrayList<NameValuePair> tuples = new ArrayList<NameValuePair>();
    tuples.add(new BasicNameValuePair(OAuthConstants.MODE, "client_auth"));
    params.put(OAuthConstants.MODE, "client_auth");
    tuples.add(new BasicNameValuePair(OAuthConstants.USERNAME, username));
    params.put(OAuthConstants.USERNAME, username);
    tuples.add(new BasicNameValuePair(OAuthConstants.PASSWORD, password));
    params.put(OAuthConstants.PASSWORD, password);

    return tuples;
  }
  protected ArrayList<NameValuePair> buildParameters(OAuthParameters params) {
    ArrayList<NameValuePair> tuples = new ArrayList<NameValuePair>();
    tuples.add(new BasicNameValuePair(OAuthConstants.MODE, "twitter_auth"));
    params.put(OAuthConstants.MODE, "twitter_auth");
    tuples.add(new BasicNameValuePair(OAuthConstants.X_TOKEN, twitterToken));
    params.put(OAuthConstants.X_TOKEN, twitterToken);
    tuples.add(new BasicNameValuePair(OAuthConstants.X_SECRET, twitterSecret));
    params.put(OAuthConstants.X_SECRET, twitterSecret);

    return tuples;
  }
  public void signForAccessToken(HttpPost req) throws FiveHundredException {

    OAuthParameters params = new OAuthParameters(this.consumerKey);
    final ArrayList<NameValuePair> tuples = buildParameters(params);

    params.put(OAuthConstants.TOKEN, this.tokenKey);

    // generate the base string for signature.
    String str = getSignatureBaseString(req, params);
    str = getSignature(str, consumerSecret, this.tokenSecret);
    params.put(OAuthConstants.SIGNATURE, str);
    // get the authorization header
    str = params.getAuthorizationHeaderValue();
    req.addHeader(OAuthConstants.HEADER, str);

    try {
      req.setEntity(new UrlEncodedFormEntity(tuples));
    } catch (UnsupportedEncodingException e) {
      throw new FiveHundredException(e);
    }
  }