Custom Object Association Error

Hi All,

First time trying Custom Code actions in workflows. I copied and pasted from GitHub then re-worked with ChatGPT a custom code action that will check if the Partner Referrer Code on the contact level is equal to the Partner Code (on the Partner Custom Object) then associate the two.

However it keeps coming up with a Hubspot 2.0 Auth error can someone please show me what I am doing wrong.

Here is the Error: HTTP-Code: 401 Message: An error occurred. Body: {“status”:“error”,“message”:“Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at Accounts Dashboard | HubSpot”} Headers: {“access-control-allow-credentials”:“false”,“cf-cache-status”:“DYNAMIC”,“cf-ray”:“8ea39a19fcd691f9-FRA”,“connection”:“keep-alive”,“content-length”:“299”,“content-type”:“application/json;charset=utf-8”,“date”:“Fri, 29 Nov 2024 15:23:58 GMT”,“nel”:“{\“success_fraction\”:0.01,\“report_to\”:\“cf-nel\”,\“max_age\”:604800}”,“report-to”:“{\“endpoints\”:[{\“url\”:\“https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=1TgjHIgQ6ZbjriKOm9BzMKcayy2yKO3g7vOkA7Hma1dN2ZBZ9EQxSHchPw3Fg%2Bx0NawvbjUQI8hFR4bJ1cKLXmhccnnF1YQSWE23faEg69hsKV7vicAUFFfTgboBQ0Yq\”}],\“group\”:\“cf-nel\”,\“max_age\”:604800}”,“server”:“cloudflare”,“strict-transport-security”:“max-age=31536000; includeSubDomains; preload”,“vary”:“origin, Accept-Encoding”,“x-content-type-options”:“nosniff”,“x-hubspot-auth-failure”:“401 Unauthorized”,“x-hubspot-correlation-id”:“48552397-bf32-4f13-88ea-7e5fee462991”}

@DCrinnion1 - the error message you report is similar to the that received when you provide an incorrect provate app token in the heqder of the API call. I don’t see this https header setup in the code fragment provided, so maybe that’s the first thing to check?

Good luck!

Steve

Hey Steve!

Apologies I am new to coding. Do I need to provide a private app token if I am trying to get an API call inside of Hubspot and not externally?

All API calls require authentication via OAuth or a Private API key with the right scopes for the object you want to manipulate. I’m sure ChatGPT would agree with that!

Steve