public function getDriveHash()
 {
     $header = ['Authorization: Bearer ' . TestOnedriveInit::getTestUserToken()];
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, self::ONERIVE_API_URL . '/drive/root?select=eTag');
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $content = curl_exec($ch);
     curl_close($ch);
     $responseAsArray = json_decode($content, true);
     if (isset($responseAsArray['error'])) {
         echo json_encode(['status' => 'Auth error', 'url' => OnedriveUserAccess::getUrlForAuth()]);
         die;
     }
     return isset($responseAsArray['eTag']) ? $responseAsArray['eTag'] : false;
 }
 public function actionGetauthcode()
 {
     return $this->redirect(OnedriveUserAccess::getUrlForAuth());
 }
 public static function getTestUserToken()
 {
     $onedriveUserAccess = OnedriveUserAccess::findByAttributes(['user_id' => Yii::$app->user->model->id]);
     return $onedriveUserAccess->access_token;
 }