APIs & Integrations

GCheal
Member

API connection issue. Cloudflare

Hi,

 

I am trying to connect to https://api.hubapi.com/oauth/v1/token, I have populated grant_type: authorization_code, client_id, client_secret, redirect_uri: http://localhost, code.

Using postman. The error is 400 Bad Request, cloudflare. I have no idea what this means. I have a colleague who has run this  test in Google Colabs. His return worked. Same information.


Any ideas why this would be?

Thanks

 

Gav

0 Upvotes
4 Replies 4
Bortami
Top Contributor | Elite Partner
Top Contributor | Elite Partner

API connection issue. Cloudflare

Here's my troubleshooting steps.

 

  1. Check to make sure your request is formatted correctly with all required headers. 

example

curl --request POST 'https://api.hubapi.com/oauth/v1/token' \
  --header 'Content-Type: application/x-www-form-urlencoded;charset=utf-8' \
  --data 'grant_type=authorization_code&client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&client_secret=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy&redirect_uri=https://www.example.com/&code=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz'

 

2. Check that Content-Type is included in your headers. It's commonly missed, and is commonly set wrong. This endpoint is different than all the other API endpoints.

 

3. Make sure the redirect_uri matches what you put in your app. HubSpot is strict about this so a https/http error can cause a problem.

 

 

 

0 Upvotes
GCheal
Member

API connection issue. Cloudflare

Hi,

 

Thank you, this I have done, and I still get the error.
I think I have a much larger problem, being that I want to do an automated run daily to extract data using ADF. It seems this is not possible due to the expiring of certain keys. These keys can only be manually retrieved. Is this right?

 

Many thanks

0 Upvotes
Bortami
Top Contributor | Elite Partner
Top Contributor | Elite Partner

API connection issue. Cloudflare

Are you building a public app or a private app for just internal use?

If you're building an internal app, you can use a Private App key with ADF and skip the need to do the OAuth exchange.

0 Upvotes
GCheal
Member

API connection issue. Cloudflare

Hi,
I am using ADF, first I tried the web activity as I wanted to get a list of all that was in scope and then loop through this list.
I have also tried using the linked service and hardcoded the required field. As getting them from the vault was not working. It seems hardcoding is also not working.
I am now getting a 403 error. So this means that I am not permitted to have access.
So this maybe progress.
Even with the 4 pieces of information do I also need the IP of ADF to be allowlisted. Or is there a handshake for this also to let this connect?
Sorry for all of the questions, I have no experience wirh Hubspot at all.

I have just got what you mean by Public and Private, this is the Hubspot app.
I don't have access to this, but I have a contact that does. Is it this that is creating the problems. They are new to Hubspot also, and I am trying to assist.

 

0 Upvotes