Hubspot App worked fine for a year - suddenly I'm getting a Bad Request error.

Highlighted
Esteemed Contributor | Gold Partner

Hi there!

 

I'm hoping someone can help.

 

So: last year I created an "app" in huspot : I have a website for a client & when people log in, I use the Hubspot API to check if they are registered in Hubpost. I have a cron job that runs every 5 hours to create a new refresh-access token. that all worked fine up until a few days ago.

 

Since then It's impossible for me to create a new access token & I keep getting the error:

HTTP ERROR 400

Problem accessing /oauth/v1/token. Reason: Bad Request

 

So I created a new app just to try, and following the usual steps I get the same result..

 

From the Hubspot App - I get an OAuth URL, which I visit, I choose the right account & grant the access I asked, I'm then redirected to the uri and I get a code in the parameter. That code I then use in combination with the clientid & secret and redirect uri .. USUALLY I get a json reponse including the refresh token & access token = so that's just not working anymore. Intead I get that Bad Request error.

 

This is the code I created which has worked for over a year.

https://ibb.co/7SzHHZL

(obviously I entered the correct code, uri, id & secret)

 

Any help would be much appreciated.

I have no idea what's wrong..

 

kind regards

Ben

Reply
0 Upvotes
2 Replies 2
Highlighted
HubSpot Moderator

Hey @benvanlooy ,

 

Sorry to hear that you're running into issues with your OAuth authorization. Can you post the raw error response body you're getting from HubSpot here (without any sensitive authentication info, if there is any)? I'd love to take a closer look at the raw error body, since it includes a message and other important troubleshooting info.

Reply
0 Upvotes
Highlighted
Esteemed Contributor | Gold Partner

thanks for replying!

 

The issue is now is fixed.

 

Apparently the Hubspot Development has made some changes to the code server-side, 

causing my code to break.

 

I wasn't sending my header the correct way (& haven't been for the past year, but it worked) and as development made the header-rules stricter this broke my code.

 

I would have expected to receive an email or see an update on the blog that there were changes made, I lost quite a lot of time fixing this.. (not the actual fixing but finding out what was wrong). Also, I would have expected to see a clear error description, instead of a vague reply.