# Authentication credentials not found.

**URL:** <https://community.hubspot.com/t/authentication-credentials-not-found/60641>\
**Category:** APIs & Integrations\
**Tags:** php, developer-tools, events\
**Created:** [July 9, 2022, 2:59pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found/60641 "2022-07-09T14:59:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LFunnel](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@LFunnel](https://community.hubspot.com/u/LFunnel)\
**Post date:** [July 9, 2022, 2:59pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found/60641/1 "2022-07-09T14:59:00Z")

</div>

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;

    }

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [July 11, 2022, 3:40pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found/60641/2 "2022-07-11T15:40:56Z")

</div>

Hi, @LFunnel 👋 Thank you for including those details. Hey, @himanshurauthan @danhammari @tominal, do you have any thoughts here for @LFunnel?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![tominal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tominal/32/73018_2.png) [@tominal](https://community.hubspot.com/u/tominal)\
**Post date:** [July 11, 2022, 10:36pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found/60641/3 "2022-07-11T22:36:02Z")

</div>

Hey @LFunnel, can you confirm the value of your $tokenType variable? That should always be “Bearer” so you could just hardcode that string there.

The API may also not like your ?hapikey= at the end of the URLs. That should be removed as HubSpot is sunsetting API keys in the future.

Hope that helps!
