OAuth2 in GraphQL node not refreshing token

I’m using the GraphQL node with OAuth2 API credentials but when the token is expired I have to create a new set of credentials in order to have the node working again. Is there any way OAuth token get’s automagically refreshed if it’s expired?

What is the error message (if any)?

[

{

“extensions”: {

“code”: “UNAUTHENTICATED”

},

“message”: “Invalid OAuth token”

}

]

Please share your workflow

Workflow only consists of GraphQL node and a manual trigger. Credentials are added to N8N credentials store.

NodeApiError: Invalid OAuth token
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/GraphQL/GraphQL.node.js:463:27)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:670:19)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:652:53

Information on your n8n setup

I’m usaing N8N Cloud v1.15.2

After creating a new credential in the credential store in N8N this action works, after an hour when the token is expired it stops working and only creating a new credential fixes the issue, this isn’t acceptable for me, does anyone have a solution for this?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Florian.O, welcome to the community though I am very sorry you are having trouble.

n8n should refresh OAuth2 tokens in principle, but this has clearly not happened in your case. Is there a chance this could come down to a missing scope or query parameter? Microsoft’s Graph API for example would require an offline_accessscope to issue a refresh token and allow n8n to refresh the OAuth2 token

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