Example #1
0
 public function login()
 {
     try {
         $this->github->authenticate($this->user, $this->pass, phpGitHubApi::AUTH_HTTP_PASSWORD);
         $userInfo = $this->github->getUserApi()->show($this->user);
         $this->github->deauthenticate();
         if (!isset($userInfo['private_gist_count'])) {
             throw ErrorFactory::makeError(ERROR_INVALID_CREDENTIALS);
         }
         return true;
     } catch (phpGitHubApiRequestException $e) {
         throw ErrorFactory::makeFromGitHubError($e);
     }
 }