Example #1
0
 /**
  * Get access token by another user (not current)
  * @param $userId
  * @return string
  */
 protected function getAccessTokenByUserSocServ($userId)
 {
     $socGoogleOAuth = new CSocServGoogleOAuth($userId);
     //this bug. SocServ fill entityOAuth in method getUrl.....
     $googleOAuthUrl = $socGoogleOAuth->getUrl('modal', CWebDavEditDocGoogle::$SCOPE);
     $accessToken = $socGoogleOAuth->getStorageToken();
     return $accessToken;
 }
Example #2
0
 /**
  * Request and store access token (self::accessToken) for self::userId
  * @return $this
  */
 public function queryAccessToken()
 {
     if (!Loader::includeModule('socialservices')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_GOOGLE_HANDLER_ERROR_NOT_INSTALLED_SOCSERV'), self::ERROR_NOT_INSTALLED_SOCSERV)));
         return false;
     }
     $socGoogleOAuth = new \CSocServGoogleOAuth($this->userId);
     //this bug. SocServ fill entityOAuth in method getUrl.....
     $socGoogleOAuth->getUrl('modal', 'https://www.googleapis.com/auth/drive');
     $this->accessToken = $socGoogleOAuth->getStorageToken();
     return $this;
 }