Oauth2 Refresh Token (Hubspot)

@jwaldrip @ljcn got fixed. We will let you know when is released.


1 Like

Just got merged. Will be released with the next version, probably on Monday.

Got released with [email protected]

1 Like

The token still expires every 6 hours. Am I missing something?

You just needed to do the OAuth2 flow again. Weird, I tested it and it was working fine.

I’ve reconnected it and created it as a new one. I’ve just put grant_type=refresh_token in the url parameter, will let you know in 6 hours! :slight_smile:

Ahhh wait. You are using the http request and not the hubspot node?

Yes, I’m using their associations, crm cards and engagement endpoints so couldn’t do it with the hubspot node. I’ve reverted back to authentication with the api key instead - it’s working fine - and it’s only communicating between an app on localhost and hubspot, so assuming this will be safe enough?

@ljcn gotcha. I thought you were working with the node. I need to have a look a see why it’s not working with the HTTP node. Yes, in the meantime, using the API Key should be safe.

Thank you - I’ve just remembered why I needed to use oauth2
For some reason, hubspot doesn’t let developer apps create objects any other way - pretty annoying!
If there is a way to get the token to refresh (using the http node) I’d be truly grateful!

Sure, will try to work on it tomorrow.

1 Like

Hi @RicardoE105, did you have any success with this? I’ve tried some novice tests but it still doesn’t refresh.
It’s not really a massive problem as I can connect to the rest of HubSpot’s api with a header auth - it’s just that one particular api requires oauth2

I looked into it and realized it’s going to take me more than expected. Not for the complexity but rather for testing that has to be done to make sure I do not break all the other nodes with OAuth2 support. Since I have many other tasks with a higher priority, I decided to push this task down in the meantime. When I get to it, I let you know. I hope that that makes sense.

That makes total sense, and I appreciate it all the same!
Thank you

1 Like

Quick update. I just picked this again and made some changes that I believe will fix the issue. Set up a workflow that runs every hour. Let’s see what happens after the 6 hours the Hubspot’s access token expires. Hopefully, that would fix the issue you and other users were having. :crossed_fingers:


Hey! Has this been resolved? I also encounter authentication issues with the HTTP Request node using oauth2 with Hubspot.

The first few requests work fine, but Hubspot returns this for requests sent 30 minutes after the authentication:

{"status":"error","message":"This oauth-token is expired! expiresAt: 1638717266335, now: 1638717605228","correlationId":"ecf67213-8f60-4fb9-a572-6364af44f0e6","category":"EXPIRED_AUTHENTICATION","errors":[{"message":"The OAuth token used to make this call expired 5 minute(s) ago."}]}

Thanks for helping

Just a quick update, here is some extra details that may help:

  • The response in my last message is the response I found in the API monitoring page on Hubspot

  • I got another response and status code (400) on my n8n node:
    {"status":"rejected","reason":{"status":400,"body":"{\"status\":\"BAD_CLIENT_ID\",\"message\":\"missing or unknown client id\",\"correlationId\":\"c0bf8ceb-0fdc-405e-a8de-e29202f3b7ed\"}","code":"ESTATUS"}}

We are a special flag for the OAuth2 in the Hubspot node. That flag is sadly not exposed in the HTTP request. Can you please make a feature request with the resource you need the Hubspot node to support?

I need to write notes on a contact (Engagement API), but I will be able to use hapikey in query to authenticate rather than oauth2 in the next n8n release (How to send an API key in query parameters? - #3 by jan)

I also need to use webhooks to listen for contact updates. Hubspot trigger seems to be broken (Scope Error using Hubspot Trigger - #8 by olliecorbs), but I can wait the merged of the related PR.

Hey Guys,

Hope you all are good!
Is this issue still open ?

I have actually 2 issues here,

  1. The connection gets timed out or say the token expires and i get status code 400.
  2. while creating OAuth2 connection If I choose Authentication Header it doesn’t goes through, while I choose Body it works fine. My Guess is that not refreshing token on it’s own may have something to do with it.

I am using the OAuth2 with the Mautic API as well and there i am able to use Authentication Header and it gets refresh with no external efforts required. the issue seems to be with Authentication with Hubspot only.