justinyueh / oauth2-php

Automatically exported from code.google.com/p/oauth2-php
MIT License
0 stars 0 forks source link

problem with get_access_token in pdo_auth.php #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please USE 

protected function get_access_token($token_id) {
  try {
    $sql = "select client_id, expires, scope from tokens where id = :token_id";
    $stmt = $this->db->prepare($sql);
    $stmt->bindParam(":token_id", $token_id, PDO::PARAM_STR);
    $stmt->execute();

    $result = $stmt->fetch(PDO::FETCH_ASSOC);

    return $result !== false ? $result : null;
  } catch (PDOException $e) {
    $this->handle_exception($e);
  }
}

INSTEAD OF 

protected function get_access_token($token_id) {
  try {
    $sql = "select client_id, expires, scope from tokens where id = :client_id";
    $stmt = $this->db->prepare($sql);
    $stmt->bindParam(":client_id", $client_id, PDO::PARAM_STR);
    $stmt->execute();

    $result = $stmt->fetch(PDO::FETCH_ASSOC);

    return $result !== false ? $result : null;
  } catch (PDOException $e) {
    $this->handle_exception($e);
  }
}

Original issue reported on code.google.com by websky...@gmail.com on 3 Aug 2010 at 4:25

GoogleCodeExporter commented 9 years ago
I support this modification. 

Original comment by pnarcis...@gmail.com on 25 Aug 2010 at 11:09

GoogleCodeExporter commented 9 years ago
Fixed in revision 969fd139d1

Original comment by aaron.parecki on 4 Sep 2010 at 6:44