You are here

public function OAuthServer::authorizeVerify in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.3 lib/oauth-php/library/OAuthServer.php \OAuthServer::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/OAuthServer.php, line 168

Class

OAuthServer

Code

public function authorizeVerify() {
  OAuthRequestLogger::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']);
    }
  }
  OAuthRequestLogger::flush();
  return $rs;
}