You are here

public function OAuthStoreOracle::getConsumerAccessToken in Lingotek Translation 7.7

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

* Fetch the consumer access token, by access token. * *

Parameters

string token: * @param int user_id * @exception OAuthException2 when token is not found * @return array token and consumer details

Overrides OAuthStoreAbstract::getConsumerAccessToken

File

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

Class

OAuthStoreOracle

Code

public function getConsumerAccessToken($token, $user_id) {
  $sql = "BEGIN SP_GET_CONSUMER_ACCESS_TOKEN(:P_USER_ID, :P_TOKEN, :P_ROWS :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_USER_ID', $user_id, 255);
  oci_bind_by_name($stmt, ':P_TOKEN', $token, 255);
  oci_bind_by_name($stmt, ':P_RESULT', $result, 20);

  //Bind the ref cursor
  $p_row = oci_new_cursor($this->conn);
  oci_bind_by_name($stmt, ':P_ROWS', $p_row, -1, OCI_B_CURSOR);

  //Execute the statement
  oci_execute($stmt);

  // treat the ref cursor as a statement resource
  oci_execute($p_row, OCI_DEFAULT);
  oci_fetch_all($p_row, $rs, null, null, OCI_FETCHSTATEMENT_BY_ROW);
  if (empty($rs)) {
    throw new OAuthException2('No server_token "' . $token . '" for user "' . $user_id . '"');
  }
  return $rs;
}