public function getAuthorizeUrl($request_token, $callback_uri = NULL, $state = NULL) {
    if (empty($callback_uri) && isset($request_token['callback_uri'])) {
      $callback_uri = $request_token['callback_uri'];
    }
    if (empty($state)) {
      $state = md5(mt_rand());
    }
    $params = array();
    if ($this->getConfig()->get('offline_access')) {
      $params += $this->getOfflineAccessParams();
    }

    $query = array(
      'response_type' => 'code',
      'client_id' => $this->getConfig('consumer_key'),
      'redirect_uri' => $callback_uri,
      'scope' => implode($this->getConfig('scope_delimiter'), $this->getScope()),
      'state' => $state,
    ) + $params;
    // authorize
    $url = Url::factory($this->getConfig('base_url'));
    $url->addPath($this->getConfig('authorize_path'));
    $url->setQuery($query);
    return (string)$url;
  }