The query in 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
    INNER JOIN {oauth_common_provider_token} pt WHERE t.uid = :uid AND t.type = :type", array(
      ':uid'  => $uid,
      ':type' => OAUTH_COMMON_TOKEN_TYPE_ACCESS,
    ));
  $tokens = array();
  while ($token = DrupalOAuthToken::fromResult($res)) {
    $tokens[] = $token;
  }
  return $tokens;
}

but from the comments in the table oauth_common_provider_token I would expect them be joined on 'tid', the key field in oauth_common_token but there is no join field specified.

Changing the join to INNER JOIN {oauth_common_provider_token} pt USING(tid) fixes the authorization list for users (user/%uid/oauth). Without the change each token is listed twice.

Comments

jobeirne’s picture

Awesome; thanks for the report. I've tested this and will be committing it.

jobeirne’s picture

Fixed in this commit. Thanks again, nevets.

jobeirne’s picture

Status: Active » Closed (fixed)
christianchristensen’s picture

Here's a 6.x patch (particularly for those who might need to patch in the mean time ;).