Exact Online API OAuth2 API keeps logging me out

Describe the problem/error/question

I am hosting n8n Community Edition on a Railway server. My setup consists of four services: n8n-main, Postgres database, n8n-worker, and Redis.
Within n8n, I successfully set up an Exact Online API OAuth2 credential, and it shows clearly as “Account connected”. The Exact Online application I am using is a development app (not yet production).
Initially, using this credential works perfectly. However, after roughly an hour, the credential gets logged out automatically, and I have to reconnect it manually. After reconnecting, it works again for a while before the issue repeats.
I have already checked that the N8N_ENCRYPTION_KEY is correctly set and have tried removing and re-adding the credential, but neither action resolved the problem.
Has anyone experienced this behavior or know what could be causing frequent logouts with OAuth2 credentials for Exact Online in n8n?

What is the error message (if any)?

Problem in node ‘Get Contacts‘
The client is not authorized to request an authorization code using this method.

Please share your workflow

Share the output returned by the last node

NodeApiError: The client is not authorized to request an authorization code using this method. at ExecuteContext.httpRequestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@opentelemetry+exporter-trace-otlp_9f358c3eeaef0d2736f54ac9757ada43/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1443:9) at processTicksAndRejections (node:internal/process/task_queues:103:5) at ExecuteContext.httpRequestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@opentelemetry+exporter-trace-otlp_9f358c3eeaef0d2736f54ac9757ada43/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1815:11) at ExecuteContext.exactOnlineApiRequest (/home/node/.n8n/nodes/node_modules/@datafix/n8n-nodes-exact-online/nodes/ExactOnline/GenericFunctions.ts:76:20) at ExecuteContext.getData (/home/node/.n8n/nodes/node_modules/@datafix/n8n-nodes-exact-online/nodes/ExactOnline/GenericFunctions.ts:96:24) at ExecuteContext.execute (/home/node/.n8n/nodes/node_modules/@datafix/n8n-nodes-exact-online/nodes/ExactOnline/ExactOnline.node.ts:459:22) at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@opentelemetry+exporter-trace-otlp_9f358c3eeaef0d2736f54ac9757ada43/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1043:8) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@opentelemetry+exporter-trace-otlp_9f358c3eeaef0d2736f54ac9757ada43/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1222:11) at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@opentelemetry+exporter-trace-otlp_9f358c3eeaef0d2736f54ac9757ada43/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1659:27 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@opentelemetry+exporter-trace-otlp_9f358c3eeaef0d2736f54ac9757ada43/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2302:11

Information on your n8n setup

  • n8n version: Version 2.9.2
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Railway
  • Operating system: Mac osX

Hi @Yanick_van_Barneveld Welcome!
This can get caused if your Exact online API is in development mode i mean not in production, try promote it to production mode if it is not then this should work.

Hi @Anshul_Namdev,

Thanks for your response! One thing I noticed is that when I set up custom OAuth2 credentials and use them in combination with a custom HTTP node, the token refresh works successfully and I’m able to retrieve data over a longer period of time.

That makes it a bit confusing why the Exact credentials are not working in the same way. Am I possibly missing something in the configuration, or is there a difference in how these credentials are handled?

Exact is saying the following:

If an app is registered under a company-specific license, it can only be used within that same license.

When an app is registered under a developer license, the goal is to build an integration that can be used across multiple clients. The app is first developed and tested within the developer environment. Once completed, it must be submitted for approval. After approval, it can be connected to licenses outside of the developer environment (i.e. commercial licenses).

In our case, the app was created directly within our company license. Because of this, it does not require approval to be used within our own administrations.

Looking forward to your insights.

1 Like

Hi @Yanick_van_Barneveld You should read this:

Mhm but this is a different credentials option. Those inputs are not within the Node / credentials of Exact which we are using, only for generic OAuth2 credentials (which can not be used for this node).