public function initSessionByUserToken($userToken) {
      $response = $this->request('get', 'initSession', ['headers' => ['Authorization' => "user_token $userToken"]]);
      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 initSessionByUserToken($userToken) {
      $response = $this->request('get', 'initSession', ['headers' => ['Authorization' => "user_token $userToken"]]);
      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 initSessionByUserToken ( $ userToken ) { $ response = $ this -> request ( 'get' , 'initSession' , [ 'headers' => [ 'Authorization' => "user_token $userToken" ] ] ) ; 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 a user token

@param string $userToken

@throws Exception

@return boolean True if success
initialize a session with a user token