public function getConn() { if (is_null($this->conn)) { $this->conn = Connection::me()->get(); } return $this->conn; }
public function checkClientToken() { $token = \TBA\Header::me()->getClientToken(); //error_log("TOKEN: {$token}"); $a = new \TBA\TokenBasedAuth(); $a->setConnection(\Charon\Connection::me()->get()); try { return $a->check($token); } catch (\Exception $e) { if ($e->getCode() == 401) { $this->naoAutorizado($e->getMessage()); } } }