I found a bug-like section.
$client = Factory::createWithAccessToken(env(“HUBSPOT_PRIVATE_APP_TOKEN_IMPORT”));
$resJobCreate = $client->crm()->imports()->coreApi()->create($csvFileObj, json_encode($import_request));
…
$client->crm()->imports()->coreApi()->getById($resJobCreate->getId());
Authentication error occurs in getById().
I have checked the SDK code.
getById() → getByIdWithHttpInfo() → getByIdRequest()
Within getByIdRequest()
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix(‘hapikey’);
if ($apiKey ! == null) {
$queryParams[‘hapikey’] = $apiKey;
}
The above code retrieves the API key, but does not seem to handle the case where an access token is set.
// this endpoint requires API key authentication
$apiKey = $this->config->getApiKeyWithPrefix(‘hapikey’);
if ($apiKey ! == null) {
$queryParams[‘hapikey’] = $apiKey;
}
// this endpoint requires OAuth (access token)
if (!empty($this->config->getAccessToken())) {
$headers[‘Authorization’] = 'Bearer ’ . $this->config->getAccessToken();
}
I modified the SDK as above and it authenticated.
composer.json
“hubspot/api-client”:“^8.3”
Please help me to determine if this is a bug.