Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find mo

# What we want to accomplish

Create two test accounts and create a contact for each.
Add, update, and retrieve Contact A data from App A
Add, update, and retrieve Contact B data from App B
We would like to manipulate Contact data from different applications as shown in the following example.

# Situation

I created a test account from a developer account and am trying to retrieve Contact in the test account using @hubspot/api-client, but I get an authentication error.

export class SearchContactService {
 private client: Client;

 constructor() {
 this.client = new Client({
 accessToken: process.env.HUBSPOT_ACCESS_TOKEN,
 });
 }
}

I have set the access token to a personal access key issued in the test account, but the authentication error persists.
Also, setting the developer API key (na2-xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) for the developer account did not resolve the issue.

Is there any solution?
Is there a wrong way to get the access key?

Hey @shihosoi, happy Tuesday.

Thank you for this information, your access token might be invalid or missing the required scopes.

Currently, Developer API keys won’t work for test accounts, you will need to use OAuth or a private app token instead.

I would recommend checking your environment settings and try regenerating the token. If the issue persists, please review your HubSpot API logs for more details.

Let us know how this works.

Kindly,

Pam

@PamCotton

We appreciate your response!

Creating a private app within the test account and using the generated access token solved the problem.

Thank you.