APIs & Integrations

Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

When i tried to get a access token through postman, i always get a BAD_SCOPES error. I tried a verity of combinations of scopes, but none of them works.

Our company has a Marketing starter account.

The error message is
{
“status”: “BAD_SCOPES”,
“message”: “missing or invalid scopes”,
“correlationId”: “b69a0bc8-e5a3-42c5-99f4-39f8ea0cbdb9”,
“requestId”: “9c7fc37f325c68d523ec1057777e72b8”
}

Our hub ID is: 2318521

0 Upvotes
13 Replies 13
worldcup123
Member

OAuth 2.0 BAD_SCOPES with a Marketing starter account

Hi, this is a different problem .

I wrote the code and received this json response:

{“refresh_token”:“xxx-xx-xx-xx-xx”,“access_token”:“xxxx”,“expires_in”:21600}

but access token is not getting stored on $myrs variable.

Here is the full code :

$cod=$_GET[“code”];

$url=“https://api.hubapi.com/oauth/v1/token?grant_type=authorization_code&client_id=x-x-x-x-x&client_secre...”.$cod;

$agent= ‘Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)’;

$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_HTTPHEADER, [‘Content-Type: application/x-www-form-urlencoded’]);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_URL,$url);

$result=curl_exec($ch);

$rest= (json_decode($result, true));
$myrs=$rest[“access_token”];

How can i store the access token in a variable ?

Thank you!

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

I have sales dashboard. But I cannot get access token from it. The error is:
{
“status”: “BAD_SCOPES”,
“message”: “missing or invalid scopes”,
“correlationId”: “18162f42-6e2c-43f8-8539-0629c2ca4895”,
“requestId”: “4d995561680127e22405f282b1270deb”
}

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@yangj in your app do you have any of these checked off?

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@pmanca Hi, I don’t see such section in sales dashboard… Thats the problem. Its only showed in Dev portal.

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@pmanca do you think I shall ask you for help or send custom support ticket through my hubspot account?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@yangj Support would be a faster response then the forum in general. In your dev portal do you have any of those boxes checked off? That would make those scopes required. They are only supposed to be in the dev portal and not your sales dashboard

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@pmanca could you please take a look at my issue? Currently, we are blocked by the connection.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@yangj The call would not work on a dev account as there are no contacts on it. Do you have the HubSpot CRM turned on for your Marketing Starter account? In your app on your dev portal what boxes do you have checked off that would be required scopes?

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@pmanca Hi, could you tell me how to turn on HubSpot CRM? I dont know how to check if its on. Thanks!

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@yangj If you can’t choose Sales in the nav drop down in the top left. Then I would reach out to support for them to do so.

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@pmanca Hi, I have created a new topic.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

OAuth 2.0 BAD_SCOPES with a Marketing starter account

@yangj Can you show me the call you are making to HubSpot? Did you make an app on your developer account? Did you require any scopes there?

0 Upvotes
Not applicable

OAuth 2.0 BAD_SCOPES with a Marketing starter account

This is the first call I make:
https://app.hubspot.com/oauth/authorize?client_id={client_id}&scope=contacts&redirect_uri=https://ww...

then I get:

The second account is our marketing starter account, and the first one is developer account.

The second call is:
https://api.hubapi.com/oauth/v1/token

  • body:
    grant_type=authorization_code&client_id={client_id}&client_secret={client_secret}&redirect_uri=https://www.hubspot.com&code={code}
    the code returned from clicking the marketing starter account.

Then I get the error:
{
“status”: “BAD_SCOPES”,
“message”: “missing or invalid scopes”,
“correlationId”: “b69a0bc8-e5a3-42c5-99f4-39f8ea0cbdb9”,
“requestId”: “9c7fc37f325c68d523ec1057777e72b8”
}

0 Upvotes