X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI.php;h=96f2cdad2d2dc3076c497d3098ee50db24218935;hb=2eeecd1ab677b49ff82b51689378d062d1e3753c;hp=bddd1672789b7d9b467dc0d6598ddea6982afa1b;hpb=e486905c83484744246ce0558b16d407df2d02b8;p=pharext%2Fpharext.org diff --git a/app/Github/API.php b/app/Github/API.php index bddd167..96f2cda 100644 --- a/app/Github/API.php +++ b/app/Github/API.php @@ -2,7 +2,6 @@ namespace app\Github; -use app\Github\API; use app\Github\Storage; use app\Github\Exception; use app\Pharext; @@ -101,7 +100,14 @@ class API } function hasToken() { - return $this->tokens->get("access_token"); + if ($this->tokens->get("access_token", $token)) { + $access_token = $token->getValue(); + if (isset($access_token)) { + return true; + } + $this->dropToken(); + } + return false; } function setToken($token) { @@ -143,7 +149,7 @@ class API function fetchToken($code, $state) { if (!$this->tokens->get("state", $orig_state, true)) { if (isset($orig_state)) { - $this->logger->notice("State expired", $orig_state); + $this->logger->notice("State expired", compact("state", "orig_state")); throw new Exception\StateExpired($orig_state->getLTL()); } throw new Exception\StateNotSet;