You are here

public function LingotekOAuthServer::authorizeVerify in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/LingotekOAuthServer.php \LingotekOAuthServer::authorizeVerify()
  2. 7.4 lib/oauth-php/library/LingotekOAuthServer.php \LingotekOAuthServer::authorizeVerify()
  3. 7.5 lib/oauth-php/library/LingotekOAuthServer.php \LingotekOAuthServer::authorizeVerify()

* Verify the start of an authorization request. Verifies if the request token is valid. * Next step is the method authorizeFinish() * * Nota bene: this stores the current token, consumer key and callback in the _SESSION * * @exception OAuthException2 thrown when not a valid request *

Return value

array token description

File

lib/oauth-php/library/LingotekOAuthServer.php, line 168

Class

LingotekOAuthServer

Code

public function authorizeVerify() {
  LingotekOAuthRequestLogger::start($this);
  $store = OAuthStore::instance();
  $token = $this
    ->getParam('oauth_token', true);
  $rs = $store
    ->getConsumerRequestToken($token);
  if (empty($rs)) {
    throw new OAuthException2('Unknown request token "' . $token . '"');
  }

  // We need to remember the callback
  $verify_oauth_token = $this->session
    ->get('verify_oauth_token');
  if (empty($verify_oauth_token) || strcmp($verify_oauth_token, $rs['token'])) {
    $this->session
      ->set('verify_oauth_token', $rs['token']);
    $this->session
      ->set('verify_oauth_consumer_key', $rs['consumer_key']);
    $cb = $this
      ->getParam('oauth_callback', true);
    if ($cb) {
      $this->session
        ->set('verify_oauth_callback', $cb);
    }
    else {
      $this->session
        ->set('verify_oauth_callback', $rs['callback_url']);
    }
  }
  LingotekOAuthRequestLogger::flush();
  return $rs;
}