src/Core/OAuth/OAuth2/OAuth2LoginHelper.php
public function exchangeAuthorizationCodeForToken($code, $realmID){
       if(!isset($code)){
            throw new SdkException("The code is not set. Can't exchange for OAuth 2 Access Token.");
       }
       $parameters = array(
          'grant_type' => 'authorization_code',
          'code' => (String)$code,
          'redirect_uri' => $this->getRedirectURL()
       );
       $authorizationHeaderInfo = $this->generateAuthorizationHeader();
       $http_header = array(
         'Accept' => 'application/json',
         'Authorization' => $authorizationHeaderInfo,
         'Content-Type' => 'application/x-www-form-urlencoded'
       );
       $intuitResponse = $this->curlHttpClient->makeAPICall(CoreConstants::OAUTH2_TOKEN_ENDPOINT_URL, CoreConstants::HTTP_POST, $http_header, http_build_query($parameters), null, true);
       $this->faultHandler = $intuitResponse->getFaultHandler();
       if($this->faultHandler) {
          throw new ServiceException("Exchange Authorization Code for Access Token failed. Body: [" . $this->faultHandler->getResponseBody() . "].", $this->faultHandler->getHttpStatusCode());
       }else{
          $this->faultHandler = false;
          $this->oauth2AccessToken = $this->parseNewAccessTokenFromResponse($intuitResponse->getBody(), $realmID);
          return $this->getAccessToken();
       }
    }
public function exchangeAuthorizationCodeForToken($code, $realmID){
       if(!isset($code)){
            throw new SdkException("The code is not set. Can't exchange for OAuth 2 Access Token.");
       }
       $parameters = array(
          'grant_type' => 'authorization_code',
          'code' => (String)$code,
          'redirect_uri' => $this->getRedirectURL()
       );
       $authorizationHeaderInfo = $this->generateAuthorizationHeader();
       $http_header = array(
         'Accept' => 'application/json',
         'Authorization' => $authorizationHeaderInfo,
         'Content-Type' => 'application/x-www-form-urlencoded'
       );
       $intuitResponse = $this->curlHttpClient->makeAPICall(CoreConstants::OAUTH2_TOKEN_ENDPOINT_URL, CoreConstants::HTTP_POST, $http_header, http_build_query($parameters), null, true);
       $this->faultHandler = $intuitResponse->getFaultHandler();
       if($this->faultHandler) {
          throw new ServiceException("Exchange Authorization Code for Access Token failed. Body: [" . $this->faultHandler->getResponseBody() . "].", $this->faultHandler->getHttpStatusCode());
       }else{
          $this->faultHandler = false;
          $this->oauth2AccessToken = $this->parseNewAccessTokenFromResponse($intuitResponse->getBody(), $realmID);
          return $this->getAccessToken();
       }
    }
Step 2 of OAuth 2 protocol. After you get authorization code, use this method to exchange an access token with it.
@param String $code            The Authorization Code returned to your redirect Uri
@param String RealmID          The Company ID that will be associated with the Acess Token. It does not use for exchange authorization Code to
authorization token, however, it will be used to help update the OAuth 2 token easier at a later step.
@return OAuth2AccessToken      The OAuth2AccessToken Object