- try {
- $this->github->fetchToken(
- $this->app->getRequest()->getQuery("code"),
- $this->app->getRequest()->getQuery("state"),
- function($token) {
- $this->github->setToken($token->access_token);
- $this->github->fetchUser($this->createUserCallback($token));
- })->send();
- if (isset($this->session->returnto)) {
- $returnto = $this->session->returnto;
- unset($this->session->returnto);
- $this->app->redirect($returnto);
- } else {
- $this->app->redirect(
- $this->app->getBaseUrl()->mod("./github"));
- }
- } catch (Exception $exception) {
- $this->app->getView()->addData(compact("exception"));
+ $this->github->fetchToken(
+ $this->app->getRequest()->getQuery("code"),
+ $this->app->getRequest()->getQuery("state"),
+ function($token) {
+ $this->github->setToken($token->access_token);
+ $this->github->readAuthUser($this->createUserCallback($token));
+ })->send();
+ if (isset($this->session->returnto)) {
+ $returnto = $this->session->returnto;
+ unset($this->session->returnto);
+ $this->app->redirect($returnto);
+ } else {
+ $this->app->redirect(
+ $this->app->getBaseUrl()->mod("./github"));