APIs & Integrations

graveland
Member

Problem starting to use oauth 2

My current attempt at using oauth 2 isn’t working so well. The first action is when my application redirects to:

https://app.hubspot.com/oauth/authorize?client_id=X&scopes=contacts&redirect_uri=http://localhost:30...

From there, I seemingly successfully ‘Grant access’ on the Request for Integration Permission page and am redirected back to the redirect_uri. No matter what I’ve tried with changing the initial redirection arguments (scopes, redirect_uri, etc), the final redirect from hubspot to my redirect_uri, it always gets directed to:

/hubspot/callback?error=invalid_request&error_description=missing+or+invalid+scopes

When I change the code to follow the oauth 1 initial URI, it works just fine and I receive an access_token.

What am I doing wrong?

Thanks!

0 Upvotes
5 Replies 5
graveland
Member

Problem starting to use oauth 2

I now have full admin privileges, and I have the same problem. It’s hubid 2527871 btw, both sales and marketing. Still seeing the redirection to http://localhost:3000/hubspot/callback?error=invalid_request&error_description=missing+or+invalid+sc...

from the initial request:

https://app.hubspot.com/oauth/authorize?client_id=X&scopes=contacts&redirect_uri=http://localhost:30...

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Problem starting to use oauth 2

That issue shouldn’t affect that HubID, but I’m also not seeing any problems with that HubID either. I’ll message you directly since I need some other details for this.

0 Upvotes
graveland
Member

Problem starting to use oauth 2

Got it sorted out thanks, I had the wrong permissions in my app.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Problem starting to use oauth 2

Hi @graveland

Can you send me the full URL you’re using? There is an issue with certain portals and the contacts scope (linked below), but if you’re able to grant access you should be getting the access token after clicking that button.

0 Upvotes
graveland
Member

Problem starting to use oauth 2

The full url from is just http://localhost:3000/webhooks/callback - but from that post you forwarded, I do see that problem, but I assumed I just didn’t have sufficient privileges (I only currently have sales admin). I created a test portal and that’s where I was successfully able to grant access. After the granting of access is where my current problem is.

The oauth 1 url that worked was:

https://app.hubspot.com/auth/authenticate?client_id=X&portalId=Y&scope=contacts-rw+offline&redirect_...

0 Upvotes