You are here

public function OAuthStoreOracle::exchangeConsumerRequestForAccessToken in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::exchangeConsumerRequestForAccessToken()
  2. 7.2 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::exchangeConsumerRequestForAccessToken()
  3. 7.3 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::exchangeConsumerRequestForAccessToken()
  4. 7.4 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::exchangeConsumerRequestForAccessToken()
  5. 7.5 lib/oauth-php/library/store/OAuthStoreOracle.php \OAuthStoreOracle::exchangeConsumerRequestForAccessToken()

* Exchange an authorized request token for new access token. * *

Parameters

string token: * @param array options options for the token, token_ttl * @exception OAuthException2 when token could not be exchanged * @return array (token, token_secret)

Overrides OAuthStoreAbstract::exchangeConsumerRequestForAccessToken

File

lib/oauth-php/library/store/OAuthStoreOracle.php, line 1148

Class

OAuthStoreOracle

Code

public function exchangeConsumerRequestForAccessToken($token, $options = array()) {
  $new_token = $this
    ->generateKey(true);
  $new_secret = $this
    ->generateKey();
  $sql = "BEGIN SP_EXCH_CONS_REQ_FOR_ACC_TOKEN(:P_TOKEN_TTL, :P_NEW_TOKEN, :P_TOKEN, :P_TOKEN_SECRET, :P_VERIFIER, :P_OUT_TOKEN_TTL, :P_RESULT); END;";

  // parse sql
  $stmt = oci_parse($this->conn, $sql) or die('Can not parse query');

  // Bind In and Out Variables
  oci_bind_by_name($stmt, ':P_TOKEN_TTL', $options['token_ttl'], 255);
  oci_bind_by_name($stmt, ':P_NEW_TOKEN', $new_token, 255);
  oci_bind_by_name($stmt, ':P_TOKEN', $token, 255);
  oci_bind_by_name($stmt, ':P_TOKEN_SECRET', $new_secret, 255);
  oci_bind_by_name($stmt, ':P_VERIFIER', $options['verifier'], 255);
  oci_bind_by_name($stmt, ':P_OUT_TOKEN_TTL', $ttl, 255);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Execute the statement
  oci_execute($stmt);
  $ret = array(
    'token' => $new_token,
    'token_secret' => $new_secret,
  );
  if (is_numeric($ttl)) {
    $ret['token_ttl'] = intval($ttl);
  }
  return $ret;
}