/**
  * Refreshes an existing authentication ticket for a customer account by providing the refresh token string.
  *
  * @param string $refreshToken Alphanumeric string used for access tokens. This token refreshes access for accounts by generating a new developer or application account authentication ticket after an access token expires.
  * @param string $responseFields Use this field to include those fields which are not included by default.
  * @return MozuClient
  */
 public static function refreshUserAuthTicketClient($refreshToken, $responseFields = null)
 {
     $url = CustomerAuthTicketUrl::refreshUserAuthTicketUrl($refreshToken, $responseFields);
     $mozuClient = new MozuClient();
     $mozuClient->withResourceUrl($url);
     return $mozuClient;
 }
 public static function authenticate(CustomerUserAuthInfo $customerAuthInfo, $tenantId, $siteId)
 {
     try {
         $authentication = AppAuthenticator::getInstance();
         $resourceUrl = CustomerAuthTicketUrl::createUserAuthTicketUrl(null);
         $client = new Client(['base_uri' => static::getAuthUrl($tenantId), 'verify' => false]);
         $headers = ["content-type" => "application/json", Headers::X_VOL_APP_CLAIMS => $authentication->getAppClaim(), Headers::X_VOL_SITE => $siteId];
         $body = json_encode($customerAuthInfo);
         $promise = $client->requestAsync($resourceUrl->getVerb(), $resourceUrl->getUrl(), ['headers' => $headers, 'body' => $body, 'exceptions' => true]);
         $response = $promise->wait();
         $jsonResp = $response->getBody(true);
         $authResponse = json_decode($jsonResp);
         $authProfile = static::setUserAuth($authResponse, $tenantId, $siteId);
         return $authProfile;
     } catch (\Exception $e) {
         HttpHelper::checkError($e);
     }
 }