Hi,
I cannot connect n8n with Mautic instance using oauth2 credentials.
The problem occurs when accessing URL:
https://n8n.example.com/rest/oauth2-credential/callback?state={state}&code={code}
On the n8n side, I get the following error:
(node:61926) UnhandledPromiseRejectionWarning: Error: HTTP status 403
at .../.npm-global/lib/node_modules/n8n/node_modules/client-oauth2/src/client-oauth2.js:283:25
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async .../.npm-global/lib/node_modules/n8n/dist/src/Server.js:852:32
In the console, I can see 302 response from Mautic but next request is failing (probably because of n8n error mentioned above).
Do you have any idea what can be wrong?
BTW Connection via Basic Auth is working.
UPDATE:
When the token expires server responses as expected so the problem is only when state and code params returned from Mautic are valid:
{"code":0,"message":"The OAuth2 callback state is invalid!","stack":"ResponseError: The OAuth2 callback state is invalid!\n at ...../.npm-global/lib/node_modules/n8n/dist/src/Server.js:828:39\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"}
Thanks Pawel.