# Cannot add tickets scope to the authorizationUrl

**URL:** <https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545>\
**Category:** APIs & Integrations\
**Tags:** oauth\
**Created:** [July 31, 2019, 11:21am UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545 "2019-07-31T11:21:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kawyns1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kawyns1/32/27089_2.png) [@kawyns1](https://community.hubspot.com/u/kawyns1)\
**Post date:** [July 31, 2019, 11:21am UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/1 "2019-07-31T11:21:26Z")

</div>

**Hi, when I try to add another scope (tickets) to my authorizationUrl, it still does not let me access my tickets. This is the error message I receive:**

Request failed for [https://api.hubapi.com/crm-objects/v1/objects/tickets/paged?properties=subject](https://api.hubapi.com/crm-objects/v1/objects/tickets/paged?properties=subject) returned code 400. Truncated server response: {“status”:“error”,“message”:“Must have scope TICKETS\_READ”,“correlationId”:“64708665-4ba9-494d-9499-8044725d896a”,“requestId”:"f5464e11-d5ff-4660-9… (use muteHttpExceptions option to examine full response) (line 27, file “getTickets”

My authentication code goes as follows:

```auto
var CLIENT_ID = 'client_id_hidden'; // Enter your Client ID
var CLIENT_SECRET = 'client_secret_hidden'; // Enter your Client secret
var SCOPE = 'contacts%20tickets'; // Change the scope based on Hubspot API page
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('hubspot')
.setTokenUrl(TOKEN_URL)
.setAuthorizationBaseUrl(AUTH_URL)
.setClientId(CLIENT_ID)
.setClientSecret(CLIENT_SECRET)
.setCallbackFunction('authCallback')
.setPropertyStore(PropertiesService.getUserProperties())
.setScope(SCOPE);
}

```

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [July 31, 2019, 9:52pm UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/2 "2019-07-31T21:52:31Z")

</div>

Hi, @kawyns1.

Happy to help.

Make sure that the user connecting the integration is either a _Super Admin_ or has full read/write access to ticket objects:

 ![Screen Shot 2019-07-31 at 5.51.33 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/f/0fde5b5410ca8eb29f3c386fcffe6c6c99686076.png)

If you believe everything is set up correctly, please share your Hub ID and the user’s email in our direct message.

---

<div class="post-metadata">

**Author:** ![kawyns1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kawyns1/32/27089_2.png) [@kawyns1](https://community.hubspot.com/u/kawyns1)\
**Post date:** [August 1, 2019, 4:07am UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/3 "2019-08-01T04:07:19Z")

</div>

Hi Isaac,

Thank you for helping out with this. I am the super admin for the developer account, how do I get to the page that you have shown in the screenshot?

Regards,

Kawyn

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [August 1, 2019, 12:35pm UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/4 "2019-08-01T12:35:10Z")

</div>

Hi, @kawyns1.

Are you referring to the developer test account ending in **1347**? I see that you are a _Super Admin_ in that account.

As such, you won’t see the toggles shown in the screenshot because super admins have all permissions in a given account. In **Settings** \> **Users & Teams** \> **[Your user]**, you will see this:

 ![Super Admin.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/0/0d6d1ca3b0efd1b2d81bf6122efd63089810a8a2.jpeg)

Are you disconnecting your app from within **Settings** \> **Integrations** \> **Apps** _before_ you go back through the OAuth flow requesting the `tickets` scope with your user?

---

<div class="post-metadata">

**Author:** ![kawyns1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kawyns1/32/27089_2.png) [@kawyns1](https://community.hubspot.com/u/kawyns1)\
**Post date:** [August 2, 2019, 4:11am UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/5 "2019-08-02T04:11:09Z")

</div>

Hi Isaac,

That is what I ended up doing. The tickets are flowing through right now.

Thanks,

Kawyn

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [August 5, 2019, 2:25pm UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/6 "2019-08-05T14:25:30Z")

</div>

Glad to hear it, @kawyns1!

---

<div class="post-metadata">

**Author:** ![kawyns1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kawyns1/32/27089_2.png) [@kawyns1](https://community.hubspot.com/u/kawyns1)\
**Post date:** [August 8, 2019, 11:12am UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/7 "2019-08-08T11:12:10Z")

</div>

Hi Isaac,

So I’m trying to get all the associations for my tickets. The get all tickets api does not seem to have an includeAssociations=true functionality. I am thinking of trying the CRM associations api but it seems I need to include a specfic objectID like a ticket ID.

How can I get the associations for all the tickets

Thanks,

Kawyn

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [August 8, 2019, 2:38pm UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/8 "2019-08-08T14:38:08Z")

</div>

Hi, @kawyns1.

Correct, the [Tickets API](https://developers.hubspot.com/docs/methods/tickets/tickets-overview) doesn’t support the `includeAssociations` parameter used in some older CRM object endpoints.

To get the objects associated with tickets, you’ll have to use [this CRM Associations API endpoint](https://developers.hubspot.com/docs/methods/crm-associations/get-associations).

The `objectId` you’ll use is the same ticket `objectId` returned from [this endpoint](https://developers.hubspot.com/docs/methods/tickets/get-all-tickets). You can then use the definition ID key on [this page](https://developers.hubspot.com/docs/methods/crm-associations/crm-associations-overview) to determine the correct `definitionId` value.

For example, if I want to see the contacts associated with ticket `12345`, I would use the following request URL (definition ID `16` is “ticket to contact”):

`https://api.hubapi.com/crm-associations/v1/associations/12345/HUBSPOT_DEFINED/16`

You would have to loop this request to retrieve associations for all tickets.

---

<div class="post-metadata">

**Author:** ![kawyns1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kawyns1/32/27089_2.png) [@kawyns1](https://community.hubspot.com/u/kawyns1)\
**Post date:** [August 9, 2019, 4:25am UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/9 "2019-08-09T04:25:09Z")

</div>

Hi Isaac,

Thanks for your reply. It seems looping is the only option. Is it possible to get associations via the deals API? For example, getting the associated tickets of all deals via the get all deals and then joining them together instead of looping through all the tickets.

Thanks,

Kawyn

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [August 9, 2019, 6:40pm UTC](https://community.hubspot.com/t/cannot-add-tickets-scope-to-the-authorizationurl/15545/10 "2019-08-09T18:40:21Z")

</div>

Hi, @kawyns1.

Yes, tickets associated with deals will be returned in the `associatedTicketIds` array in the `associations` object if you include the `includeAssociations=true` parameter when querying [this endpoint](https://developers.hubspot.com/docs/methods/deals/get-all-deals).

This approach assumes that all tickets are associated with deals.
