# Authentication credentials not found "INVALID\_AUTHENTICATION"

**URL:** <https://community.hubspot.com/t/authentication-credentials-not-found-invalid-authentication/76500>\
**Category:** APIs & Integrations\
**Tags:** companies\
**Created:** [March 5, 2023, 10:51pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found-invalid-authentication/76500 "2023-03-05T22:51:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ROMG](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@ROMG](https://community.hubspot.com/u/ROMG)\
**Post date:** [March 5, 2023, 10:51pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found-invalid-authentication/76500/1 "2023-03-05T22:51:09Z")

</div>

I’m receiving an ‘’ error when trying to update a company using Private App credentials.

I’ve looked through similar discussions and havent found anything that relates to my issue.

Im using the following to import company data to my application, which is working fine:

```lia-code-sample
const hubspotHeaders = {
 headers: {
 'Authorization': `Bearer ${process.env.HBSSANDBXAPPK}`,
 'Content-Type': 'application/json'
 }
}; 

const fetchData = (url) => {
 return axios.get(url, hubspotHeaders).then(response => {
 console.log(response.data)
 })
 .catch(function (error) {
 console.log(error)
 });
};
fetchData(`https://api.hubapi.com/crm/v4/objects/companies?${hapikeyParam}`);

```

However, when I change the API endpoint and request to ‘patch’, I receive the error:

```lia-code-sample
const hubspotHeaders = {
 headers: {
 'Authorization': `Bearer ${process.env.HBSSANDBXAPPK}`,
 'Content-Type': 'application/json'
 }
}; 
const properties = {
 "seo_revenue": 0
};

const putData = (url) => {
 return axios.patch(url, properties, { hubspotHeaders }).then(response => {
 console.log(response.data)
 })
 .catch(function (error) {
 console.log(error)
 });
};
putData(`https://api.hubapi.com/crm/v4/objects/companies/01010101010101`);

```

“message: 'Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/methods/auth/oauth-over)”

Am I missing something that PATCH requests require? Seems strange that the GET requests works but the PATCH request fails with an error.  
Any information regarding this issue would be much appreciated, thank you.

---

<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:** [March 7, 2023, 5:33pm UTC](https://community.hubspot.com/t/authentication-credentials-not-found-invalid-authentication/76500/2 "2023-03-07T17:33:23Z")

</div>

Hi, @ROMG 👋 Thanks for reaching out. I have a few questions to help the community better understand the issue and the steps you’ve already taken:

- Have you already tried a simplified test? For example, can you make the same PATCH request using your Private App the Python example directly from the endpoints tab for this endpoint? — [Associations API](https://developers.hubspot.com/docs/api/crm/associations)
- Do you get the same error when trying a similar PATCH request from the [Company API endpoints](https://developers.hubspot.com/docs/api/crm/companies)? Instead of the Associations endpoints your example used? **PATCH** `/crm/v3/objects/companies/{companyId}`

Thanks for the additional information!

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![ROMG](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@ROMG](https://community.hubspot.com/u/ROMG)\
**Post date:** [April 21, 2023, 2:18am UTC](https://community.hubspot.com/t/authentication-credentials-not-found-invalid-authentication/76500/3 "2023-04-21T02:18:22Z")

</div>

Sorry for the late reply, we had multiple issues with this issues trying to post or patch with Node.js using Hubspot endpoints that we just wrote it in PHP. Not sure why it works with PHP and not Node.js but might want to look into that as there are multiple community tickets around this issue.
