Hii I am getting this error while using curl operation in PHP to get the user events information and want to store it in the database.
"{"status":"error","message":"Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview","correlationId":"a8a9a354-ee9b-4921-9f7b-1d988db48d5b"} ◀"
note*: I’m using the new access token not the expired one
my code is here:-
These are my endpoints
$endpoints = array(
'ticketsData' => '/crm-objects/v1/objects/tickets/paged',
'company\_propertyData' => '/properties/v1/companies/properties/named/an\_example\_property',
'contact\_propertyData' => '/properties/v1/contacts/properties',
'email\_subscriptionData' => '/email/public/v1/subscriptions',
'email\_subscription\_timelineData' => '/email/public/v1/subscriptions/timeline',
'form\_submissionData' => '/forms/v2/forms',
'new\_line\_itemData' => '/crm-objects/v1/objects/line\_items/paged'
);
------------------------------------------------------------
//code to get information of each endpoints
foreach($endpoints as $key=>$data){
$ch = curl\_init();
curl\_setopt($ch, CURLOPT\_URL, "https://api.hubapi.com".$data.'?hapikey=');
curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(
'Authorization: '.$tokenType.' '.$accessToken
));
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);
$server\_output = curl\_exec($ch);
dd($server\_output);
curl\_close($ch);
$crmData\[$key] = $server\_output;
}