ac2ce7b481d2bca63e680769e55833708c8b04e8
3 namespace app\Controller\Github
;
5 use app\Controller\Github
;
7 class Callback
extends Github
9 function __invoke(array $args = null) {
10 if ($this->app
->getRequest()->getQuery("error")) {
11 $this->app
->getView()->addData([
12 "error" => $this->app
->getRequest()->getQuery("error_description")
16 $this->github
->fetchToken(
17 $this->app
->getRequest()->getQuery("code"),
18 $this->app
->getRequest()->getQuery("state"),
20 $this->github
->setToken($json->access_token
);
22 if (isset($this->session
->returnto
)) {
23 $this->app
->redirect($this->session
->returnto
);
26 $this->app
->getBaseUrl()->mod("./github"));
28 } catch (\app\Github\Exception
$exception) {
29 $this->app
->getView()->addData(compact("exception"));
32 $this->app
->display("github/callback");