public void retrieveAccessToken(OAuthConsumer consumer, String oauthVerifier)
      throws OAuthMessageSignerException, OAuthNotAuthorizedException,
          OAuthExpectationFailedException, OAuthCommunicationException {

    if (consumer.getToken() == null || consumer.getTokenSecret() == null) {
      throw new OAuthExpectationFailedException(
          "Authorized request token or token secret not set. "
              + "Did you retrieve an authorized request token before?");
    }

    if (this.isOAuth10a && oauthVerifier != null) {
      retrieveToken(consumer, this.accessTokenEndpointUrl, OAuth.OAUTH_VERIFIER, oauthVerifier);
    } else {
      retrieveToken(consumer, this.accessTokenEndpointUrl);
    }
  }