OAuth2 access token not refreshing

Describe the issue/error/question

I’m trying to connect my Hubspot App using OAuth2 credentials. I managed to connect it successfully and I can make HTTP calls to Hubspot using the HTTP node. Actually I can run the full workflow.
Hubspot access tokens live span is 30 minutes, so after that it need to be refreshed.

During the first 30 minutes after the initial authentication everything works fine, but after that I get a 400 error:

 "message":"missing or unknown client id",

I assume that happens because the refresh has not been successful.

How does n8n handle access token refreshes? Is some extra config needed in the OAuth config window?

Thanks :+1:

Information on your n8n setup

  • n8n version: 0.206.1
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: n8n.cloud
1 Like

Hi there,

This has been fixed in a later version of n8n I think.
So try updating.

We’ve updated to 0.210.2 and the problem still persists.

Any suggestions?

1 Like

Hi @BramKn (and team).

We had a similar issue with OAuth2 tokens expiring and not getting refreshed. Basically as soon as they expired we started getting 401 exceptions on our API calls that the token was expired but they didn’t automatically recover. As soon as I ‘reconnected’ the credential the workflows started working again as expected but it expired again at the same time as the OAuth token expiring.

We were on 0.209.4 at the time and have just updated to 0.213.0 to see if it fixes the issue. We didn’t notice the issue on the previous version we were on before 0.209.4 (I forget the exact version).

Do you know by chance when the issue first came up? And which version it was fixed in?

1 Like

Hi @NealSr

Welcome to the community!

I have no idea. Should be in the changelog.
It was fixed before 209.4 I think. So it should work if it wasn’t broken again.
Sadly I cannot really help you out here.

I have the same problem, connecting to Google Bigquery with Oauth2. First manual connect is fine, but a later refresh does not seem to work. If I schedule a workflow to run automatically +5 hours after my manuall reconnect I get the error.

Looking at the failed bigquery node it says:


And stack says:

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.execute (/app/code/node_modules/n8n-nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts:988:12)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Workflow.runNode (/app/code/node_modules/n8n-workflow/src/Workflow.ts:1270:19)
    at /app/code/node_modules/n8n-core/src/WorkflowExecute.ts:938:29

I’m currently on v.0.214.0 - and still experience this issue.

Tried looking into logs, but nothing to see there.

Hi all, OAuth2 can be a pain I am afraid. I don’t know what exactly might be wrong in your specific case @LE_Christensen, but I have complained to our poor product team many times about the limited error logging around OAuth2 refreshes (just for internal reference, this is issue N8N-5992).

Are you using generic OAuth2 credentials (for example to sue the HTTP Request node) when running into this issue or are you using BigQuery-specific credentials?

Got released with [email protected]

Hi @MutedJam

Since the BigQuery module can only do “Create” or “Get Many” I have to use a HTTP Request Node for my usecases.

I am using a HTTP Request Node for calling BigQuery API - I can only use a generic OAuth2 crediential type, I don’t get the option to chose BiqQuery specific credentials for the HTTP Request Node.

I updated to [email protected] yesterday - and it still gave me same error. The message “UNKNOWN ERROR - check the detailed error for more information” is making me sad. I have no idea where I can see “detailed error”. I tried looking into server-logs, but there is nothing.

Module error output is just:


Hi @LE_Christensen, I understand your frustration and actually share it to quite some extent. OAuth2 issues are extremely frustrating for me as well and the output you have shared does not make it easier. That said, the BigQuery node will soon get an upgrade and you might want to follow the process on the respective pull request:

Lastly, you can always use the HTTP Request node without pre-configured authentication to manually make the requests required to fetch & renew a token. This gives you the maximum amount of flexibility and avoids n8n’s built-in OAuth2 logic completely.


Cool, thank you @MutedJam

I will keep an eye on the bigquery node improvements in github (subscribed to notifications).

The upcoming changes looks good. From what I can read from the committed code, it seems like BigQuery node will be able to use service accounts, including running a custom query :heart: - thats really awesome.

I suppose if the feature is not ready in a week or so, I will probably do as you suggest, to create my own fetch & refresh token flow. Until then I manage by manually reconnecting, and manually running the workflow.

Do you know if the BigQuery feature is planned for the near future?
The github issue was last touched a month ago, but seems to be stuck in review ?

Hey @LE_Christensen,

I have checked the internal ticket and it looks like it is still being reviewed, I would love to give you a timeline but I just don’t have one at the moment. I will bring it up in our node team review meeting tomorrow morning though.

1 Like

I see in the release notes for [email protected] there was an oauth2 update so I’ll go ahead and try to upgrade and report back.

Sounds great. Did you have a chat at the review meeting?

Hey @LE_Christensen,

I did indeed, The node is still being reviewed but the chap that worked on it seemed fairly confident that was all good. The internal assignee for the review was away but has also been very busy with other features so this is one of those things that got moved down the queue a bit but it will be happening.

I’ve tried to make a workflow to manually make the request to fetch and renew a token from google bigquery api (oauth2) - but I’m at a loss on how to do it properly. Do you have an example on how to solve such a manual fetch and renewal of oauth2 token in n8n ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.