You are here

function oauth_common_get_user_provider_tokens in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.module \oauth_common_get_user_provider_tokens()
  2. 7.3 oauth_common.module \oauth_common_get_user_provider_tokens()

Gets the tokens for a user.

Parameters

string $uid:

string $type:

Return value

array

1 call to oauth_common_get_user_provider_tokens()
oauth_common_page_user_authorizations in ./oauth_common.authorizations.inc
@file Functions related to a user's authorization section

File

./oauth_common.module, line 420

Code

function oauth_common_get_user_provider_tokens($uid) {
  $res = db_query("SELECT t.*, pt.created, pt.changed, pt.services, pt.authorized FROM {oauth_common_token} t\n    INNER JOIN {oauth_common_provider_token} pt WHERE t.uid = %d AND t.type = %d", array(
    ':uid' => $uid,
    ':type' => OAUTH_COMMON_TOKEN_TYPE_ACCESS,
  ));
  $tokens = array();
  while ($token = DrupalOAuthToken::fromResult($res)) {
    $tokens[] = $token;
  }
  return $tokens;
}