Oauth2 authentication API


#1

Hi,

We're starting a new integration with your system where we want to use the Oauth2.0. In our case, the connection will be through API calls.

How can we handle the Oauth2.0 authentication? We followed the steps defined at https://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration

but we're not able to make it work.

App id = 145974
HUB id = 2978896

We have all the scopes checked. We pass all the scopes in the URL :
https://app.hubspot.com/oauth/authorize?scope=contacts+content+reports+social+automation+timeline+forms+files+hubdb+transactional-email&redirect_uri=https%3A%2F%2Fwww.example.com%2F&client_id=174ac903-0cca-492d-be8b-0f5e5e8b12a8

But still we dont manage to get the code from the url.

Uh oh!
Insufficient scopes were provided. Please contact the integrator.

Does that make sense? There's a way to retrieve the token without the 'obtain the code' part?

Best regards


#2

Hi @javi-tt,

The issue is likely that you have all the scopes in the developer portal UI checked off. You should only check the scopes that are absolutely required for the integration to work, and you should leave the 'Add action forms' scope unchecked since that feature has been sunset.

Additionally, you should make sure that you're only including scopes that you need and have access to in your authorization URL. I can see that the transactional-email scope is included in the example URL you listed; if your portal doesn't have access to the transactional email add on, you won't be able to authorize the integration.