public function refreshToken(){
       $refreshToken = $this->getAccessToken()->getRefreshToken();
       $http_header = $this->constructRefreshTokenHeader();
       $requestBody = $this->constructRefreshTokenBody($refreshToken);
       $intuitResponse = $this->curlHttpClient->makeAPICall(CoreConstants::OAUTH2_TOKEN_ENDPOINT_URL, CoreConstants::HTTP_POST, $http_header, $requestBody, null, true);
       $this->faultHandler = $intuitResponse->getFaultHandler();
       if($this->faultHandler) {
          throw new ServiceException("Refresh OAuth 2 Access token with Refresh Token failed. Body: [" . $this->faultHandler->getResponseBody() . "].", $this->faultHandler->getHttpStatusCode());
       }else{
          $this->faultHandler = false;
          $this->oauth2AccessToken = $this->parseNewAccessTokenFromResponse($intuitResponse->getBody());
          return $this->getAccessToken();
       }
    }
public function refreshToken(){
       $refreshToken = $this->getAccessToken()->getRefreshToken();
       $http_header = $this->constructRefreshTokenHeader();
       $requestBody = $this->constructRefreshTokenBody($refreshToken);
       $intuitResponse = $this->curlHttpClient->makeAPICall(CoreConstants::OAUTH2_TOKEN_ENDPOINT_URL, CoreConstants::HTTP_POST, $http_header, $requestBody, null, true);
       $this->faultHandler = $intuitResponse->getFaultHandler();
       if($this->faultHandler) {
          throw new ServiceException("Refresh OAuth 2 Access token with Refresh Token failed. Body: [" . $this->faultHandler->getResponseBody() . "].", $this->faultHandler->getHttpStatusCode());
       }else{
          $this->faultHandler = false;
          $this->oauth2AccessToken = $this->parseNewAccessTokenFromResponse($intuitResponse->getBody());
          return $this->getAccessToken();
       }
    }
public function refreshToken ( ) { $ refreshToken = $ this -> getAccessToken ( ) -> getRefreshToken ( ) ; $ http_header = $ this -> constructRefreshTokenHeader ( ) ; $ requestBody = $ this -> constructRefreshTokenBody ( $ refreshToken ) ; $ intuitResponse = $ this -> curlHttpClient -> makeAPICall ( CoreConstants :: OAUTH2_TOKEN_ENDPOINT_URL , CoreConstants :: HTTP_POST , $ http_header , $ requestBody , null , true ) ; $ this -> faultHandler = $ intuitResponse -> getFaultHandler ( ) ; if ( $ this -> faultHandler ) { throw new ServiceException ( "Refresh OAuth 2 Access token with Refresh Token failed. Body: [" . $ this -> faultHandler -> getResponseBody ( ) . "]." , $ this -> faultHandler -> getHttpStatusCode ( ) ) ; } else { $ this -> faultHandler = false ; $ this -> oauth2AccessToken = $ this -> parseNewAccessTokenFromResponse ( $ intuitResponse -> getBody ( ) ) ; return $ this -> getAccessToken ( ) ; } }
Get a new access token based on the refresh token
@return OAuth2AccessToken     A new OAuth2AccessToken that contains all the information(accessTokenkey, RefreshTokenKey, ClientID, and ClientSecret, Expiration Time, etc)
Get a new access token based on the refresh token