public function initSessionByCredentials($user, $password) {
      $response = $this->request('get', 'initSession', ['auth' => [$user, $password]]);
      if ($response->getStatusCode() != 200
         || !$this->sessionToken = json_decode($response->getBody()->getContents(), true)['session_token']) {
         $body = json_decode($response->getBody()->getContents());
         throw new Exception(ErrorHandler::getMessage($body[0]));
      }
      return true;
   }
public function initSessionByCredentials($user, $password) {
      $response = $this->request('get', 'initSession', ['auth' => [$user, $password]]);
      if ($response->getStatusCode() != 200
         || !$this->sessionToken = json_decode($response->getBody()->getContents(), true)['session_token']) {
         $body = json_decode($response->getBody()->getContents());
         throw new Exception(ErrorHandler::getMessage($body[0]));
      }
      return true;
   }
public function initSessionByCredentials ( $ user , $ password ) { $ response = $ this -> request ( 'get' , 'initSession' , [ 'auth' => [ $ user , $ password ] ] ) ; if ( $ response -> getStatusCode ( ) != 200 || ! $ this -> sessionToken = json_decode ( $ response -> getBody ( ) -> getContents ( ) , true ) [ 'session_token' ] ) { $ body = json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; throw new Exception ( ErrorHandler :: getMessage ( $ body [ 0 ] ) ) ; } return true ; }
Initialize a session with user credentials
@param string $user
@param string $password
@throws Exception
@return boolean
Initialize a session with user credentials