You are here

public function OAuthStorePostgreSQL::getConsumerAccessToken in Lingotek Translation 7.4

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

Fetch the consumer access token, by access token.

@exception OAuthException2 when token is not found

Parameters

string token:

int user_id:

Return value

array token and consumer details

Overrides OAuthStoreAbstract::getConsumerAccessToken

File

lib/oauth-php/library/store/OAuthStorePostgreSQL.php, line 1420

Class

OAuthStorePostgreSQL

Code

public function getConsumerAccessToken($token, $user_id) {
  $rs = $this
    ->query_row_assoc('
                SELECT    ost_token                as token,
                        ost_token_secret        as token_secret,
                        ost_referrer_host        as token_referrer_host,
                        osr_consumer_key        as consumer_key,
                        osr_consumer_secret        as consumer_secret,
                        osr_application_uri        as application_uri,
                        osr_application_title    as application_title,
                        osr_application_descr    as application_descr,
                        osr_callback_uri        as callback_uri
                FROM oauth_server_token
                        JOIN oauth_server_registry
                        ON ost_osr_id_ref = osr_id
                WHERE ost_token_type = \'access\'
                  AND ost_token      = \'%s\'
                  AND ost_usa_id_ref = \'%d\'
                  AND ost_token_ttl  >= NOW()
                ', $token, $user_id);
  if (empty($rs)) {
    throw new OAuthException2('No server_token "' . $token . '" for user "' . $user_id . '"');
  }
  return $rs;
}