Example #1
0
 /**
  * For OAuth we can check existing access token.
  * Useful for API calls.
  *
  * @return bool
  * @throws ErrorException
  */
 public function getIsAuthenticated()
 {
     if (!$this->authenticated) {
         try {
             $proxy = $this->getProxy();
             $this->authenticated = $proxy->hasValidAccessToken();
         } catch (\OAuth\Common\Exception\Exception $e) {
             throw new ErrorException($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e);
         }
     }
     return parent::getIsAuthenticated();
 }
Example #2
0
 /**
  * Initialize the component.
  */
 public function init()
 {
     parent::init();
     $this->auth = new LightOpenID(Yii::$app->getRequest()->getHostInfo());
 }