I am able to get the token okay, however, when I send the request for contacts I get the following error:
[input] => Array
(
[token] => 8c*************************************
[url] => https://api.hubapi.com/contacts/v1/lists/all/contacts/all?count=1
)
[resultRaw] => {"status":"error","message":"Any of the listed authentication credentials are missing","correlationId":"f8054a17-ebc6-4c6d-b4e9-2b304d4a07c0","engagement":{"vendorkey-gae":"vendorkey-gae not engaged. Vendorkey not found in request headers.","hapikey":"hapikey not engaged. hapikey is not present in query params.","oauth-token":"oauth-token not engaged. Malformed OAuth access token found in request header.","shhkey-v1":"shhkey-v1 not engaged. Shhkey not found in the request header.","internal-cookie":"internal-cookie not engaged. Cookie not found in the request.","app-cookie":"app-cookie not engaged. App cookie is not present on the request."},"requestId":"cf6d3859b8fd01fe396cdcb8235ac6f5"}
[resultArray] => Array
(
[status] => error
[message] => Any of the listed authentication credentials are missing
[correlationId] => f8054a17-ebc6-4c6d-b4e9-2b304d4a07c0
[engagement] => Array
(
[vendorkey-gae] => vendorkey-gae not engaged. Vendorkey not found in request headers.
[hapikey] => hapikey not engaged. hapikey is not present in query params.
[oauth-token] => oauth-token not engaged. Malformed OAuth access token found in request header.
[shhkey-v1] => shhkey-v1 not engaged. Shhkey not found in the request header.
[internal-cookie] => internal-cookie not engaged. Cookie not found in the request.
[app-cookie] => app-cookie not engaged. App cookie is not present on the request.
)
[requestId] => cf6d3859b8fd01fe396cdcb8235ac6f5
)
I am using the following Code:
$header = array(“Authorization: Bearer {$token}”);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => $header,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true
));
$result[“resultRaw”] = $response = curl_exec($curl);
curl_close($curl);
$result[“resultArray”] = json_decode($result[“resultRaw”], true);
curl_close ($ch);
return $result;