APIs & Integrations

RobertMarinho
Participant

INVALID_AUTHENTICATION using APIKEY provided by process.env on serverless functions

Hello,

I'm using serverless functions to handle subscription preferences through API endpoints. 

 

I'm getting INVALID_AUTHENTICATION when I use the APIKEY provided by process.env

RobertMarinho_0-1648480338617.png

RobertMarinho_1-1648480383405.png

 

Otherwise It works If I just copy and paste the api key provided on the settings panel (Which I think is not an ideal solution):

RobertMarinho_3-1648480485852.png

RobertMarinho_2-1648480465928.png

Am I missing some API key scope configuration?

Anyone else having this issue?

 

Thanks,

 

 

 

 

0 Upvotes
2 Replies 2
RobertMarinho
Participant

INVALID_AUTHENTICATION using APIKEY provided by process.env on serverless functions

Hi @ChehakWadhdwa 

I have tried It but same result:

{
"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": "dc5707e7-d988-4a28-b1fe-42836adfbb95",
"category": "INVALID_AUTHENTICATION"
}

Something I didn't mentioned is that It works for the other api calls like:  

/cms/v3/hubdb/...
/activities/v2/reports/...

BUT not specifically with the Subscription preferences endpoints:

/communication-preferences/v3/...

Which leads me to think about an scoping issue maybe?

Thank you,

 

0 Upvotes
ChehakWadhdwa
Member | Diamond Partner
Member | Diamond Partner

INVALID_AUTHENTICATION using APIKEY provided by process.env on serverless functions

hey @RobertMarinho  

use

process.env.HAPIKEY

instead of process.env

 

0 Upvotes