Paragon and contacts scope

LMenghini
Member

Hello everyone. I'm using Paragon to authenticate to Hubspot, and using their SDK to make my API calls. I'm trying to fetch the deals, but upon running the following code

const res = await paragon.request("hubspot", "/crm/v3/objects/deals", { 
  method: "GET"
});

I get back the following error:

{
...
"errors": [
	{
	"message": "One or more of the following scopes are required.",
	"context": {
		    "requiredScopes": ["contacts"]
		}
	}
],
...
}

 But, I thought the contacts scope had been deprecated in favour of crm.objects.contacts.read and crm.objects.contacts.write (which I actually have).

What gives? There is some complications in that Paragon won't allow me to add the missing scope (as they have flagged it as deprecated or so it seems) so I'm trying to figure out what's wrong. Can anyone help?

0 Upvotes
1 Accepted solution
LMenghini
Solution
Member

Hey Jaycee, thanks for replying! Turns out the issue was way easier than expected: the API was just lying straight to my face. The error message as you can see above explicitly states that the missing scope was "contacts". It was not: it was "crm.objects.deals.read". Extremely simple fix, but I believe that somewhere in the Hubspot code there might be an error and that very misleading message gets generated.

View solution in original post

2 Replies 2
Jaycee_Lewis
Thought Leader

Hi, @LMenghini 👋 Thanks for reaching out. It will be easier to split this out into two parts, I think.

 

Paragon questions —

  • To confirm, this is the product you are referring to, correct? Paragon — HubSpot
  • Looking at your code sample, it looks like you are calling the Deals API. Is that correct?
  • If so, can you grab a screenshot of the scopes in your private app? Similar to this one deal-scope.png

HubSpot side:

GET /crm/v3/objects/deals/{dealId}​
  • You can use a private app with only the two granular scopes shown above, and it will work as expected from our end

My quick test
Request

curl --request GET \
  --url 'https://api.hubapi.com/crm/v3/objects/deals/9786091184?archived=false' \
  --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

 

Response

HTTP 200

{
  "id": "9786091184",
  "properties": {
    "amount": null,
    "closedate": "2022-09-01T00:05:39.484Z",
    "createdate": "2022-08-11T00:05:47.455Z",
    "dealname": "Hire some cats",
    "dealstage": "appointmentscheduled",
    "hs_lastmodifieddate": "2022-08-12T19:16:15.308Z",
    "hs_object_id": "9786091184",
    "pipeline": "default"
  },
  "createdAt": "2022-08-11T00:05:47.455Z",
  "updatedAt": "2022-08-12T19:16:15.308Z",
  "archived": false
}

 

It will not be possible to trouble shoot the Paragon side of things. Our best move is to verify the endpoint works while using the minimum required scopes.

 

My suggestion is to verify you have the granular scopes for deals added. If the issue persists, I'd reach out to Paragon support and inquire why their app is attempting to use a depreciated scope instead of the granular scopes. Here's an article with more details — Contacts scope migration for app partners. 

 

 

Hey, @JBeatty @LMeert @miljkovicmisa do you have any additional thoughts on troubleshooting here?

 

Thank you very much! — Jaycee





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
LMenghini
Solution
Member

Hey Jaycee, thanks for replying! Turns out the issue was way easier than expected: the API was just lying straight to my face. The error message as you can see above explicitly states that the missing scope was "contacts". It was not: it was "crm.objects.deals.read". Extremely simple fix, but I believe that somewhere in the Hubspot code there might be an error and that very misleading message gets generated.