OAuth Truncated server response

KB496
Participant | Partner

Hello,

 

I'm getting this error as I list Line Items and its properties. 

 

Exception: Request failed for https://api.hubapi.com returned code 400. Truncated server response: {"status":"error","message":"Must have scope deal-line-item-read","correlationId":"cb02b012-5675-4aae-b23f-d8d4f6d99f7d","requestId":"5a611ac1-408c... (use muteHttpExceptions option to examine full response)

 

 

Authentication Code: 

var CLIENT_ID = 'client_id_hidden'; // Enter your Client ID
var CLIENT_SECRET = 'client_secret_hidden'; // Enter your Client secret
var SCOPE = 'contacts%20oauth'; // scope 
var AUTH_URL = 'https://app.hubspot.com/oauth/authorize';
var TOKEN_URL = 'https://api.hubapi.com/oauth/v1/token';
var API_URL = 'https://api.hubapi.com';

function getService() {
return OAuth2.createService('hub')
.setTokenUrl(TOKEN_URL)
.setAuthorizationBaseUrl(AUTH_URL)
.setClientId(CLIENT_ID)
.setClientSecret(CLIENT_SECRET)
.setCallbackFunction('authCallback')
.setPropertyStore(PropertiesService.getUserProperties())
.setScope(SCOPE);
}

Url: 

var url = "https://api.hubapi.com/crmobjects/v1/objects/line_items/410631854&properties=name&properties=quantit...";

 

0 Upvotes
7 Replies 7
WendyGoh
HubSpot Employee

Hey @KB496,

 

Can you share with me the portal ID that you're making this request on?

0 Upvotes
KB496
Participant | Partner

Hello,

 

Below is the Portal Id :  

5523720

 

Thank you,

Komal

0 Upvotes
WendyGoh
HubSpot Employee

Hey @KB496,

 

This is truly strange. On my end, I'm able to see that portal 5523720 has the deal-line-item-read scope. Additionally, I note that user (komal.bhxxx@sxxxxx.com) who installed the app has super admin, sales enterprise and service enterprise roles. Hence, I wouldn't expect to see the "Must have scope deal-line-item-read" error.

 

In this case, can we try re-auth app 211494 on portal 5523720 and see if the error continues?

0 Upvotes
KB496
Participant | Partner

Hi @WendyGoh ,

 

I re-auth the app the issue still unresolved and gives me the same error. Additionally I tried adding scope='deal-line-item-read';  as well but still no luck. 

 

 

0 Upvotes
WendyGoh
HubSpot Employee

Hey @KB496,

 

Do you mind if I set a redirect url and re-auth app 211494 on portal 5523720 and try to use this endpoint using the OAuth access token?

 

0 Upvotes
KB496
Participant | Partner

Hi @WendyGoh ,

 

okay sure.

 

0 Upvotes
WendyGoh
HubSpot Employee

Hey @KB496,

 

I have send you a message on my findings.

0 Upvotes