Ejemplo n.º 1
0
 private function authApplication()
 {
     if ($this->settings->getAuthType() === Methods_Method_Auth::TYPE_PUBLIC && $this->getAuthCode()) {
         return true;
     }
     $params = array('client_id' => $this->settings->app_id, 'client_secret' => $this->settings->app_secret, 'redirect_uri' => $this->settings->redirect_url, 'grant_type' => 'client_credentials');
     $get_string = $this->paramsArrayToString($params);
     $url = 'https://api.vk.com/oauth/access_token?' . $get_string;
     $data = $this->transport->readJson($url);
     if (isset($data['access_token']) && !empty($data['access_token'])) {
         $this->settings->access_token = $data['access_token'];
         if (isset($data['user_id'])) {
             $this->user_id = $data['user_id'];
         }
         return true;
     }
     return false;
 }