Microsoft Excel OAuth2 API --> "Unknown error"

Hi all,

As suggested by @Jon here is a dedicated thread for my issue.
After setting up proper webhook_url environment variable, I successfully authenticated with my Azure account but I ended up with the following error on the callback window :

{"code":0,"message":"Unknown error"}

Checked on the log (debug on) → No issue and even got confirmation OAuth2 authentication successful…

{"level":"verbose","message":"OAuth2 authentication successful for new credential","metadata":{"credentialId":"1","file":"oauth2Credential.api.js","timestamp":"2022-12-04T23:19:19.206Z","userId":"4fcad76a-10c9-43fa-af6e-d3003a449a19"}}

My info:

  • n8n version: 0.205.0
  • Database: Default (SQLLite)
  • Running n8n with the execution process: Own
  • Running n8n via: Docker

I was getting a similar thing happening with trying to add scopes to Xero Oauth

basically after a restart of docker container and new browser session tried again and it worked

Docker restarted several time, web browser cache erased, and even tried from another device: still doesn’t on my side :pensive:

Hi all, I’ve seen a few reports about this now and I am so sorry for the trouble :frowning:

I know @RicardoE105 has done a lot of work on the OAuth2 side of things, perhaps he has an idea what might be causing the problem or what to look out for if n8n throws an “Unknown error” following the callback?

Perhaps you can also describe step by step how you have registered your Azure app so I can try and reproduce this on my side? I’ve tried registering a new Azure app just the other day on 0.204.0 and wasn’t able to reproduce this particular problem.

With 0.205.0 having trouble with remembering OAuth2 scopes, perhaps you can also check if the issue occurs with [email protected] for you @NickFR?

I was getting this error with 0.204.0 already.

I just follow the official documentation steps–> Microsoft credentials | n8n Docs

I saw 0.206.1 just got release I’ll try with it and let you know.
[EDIT] Juste upgraded = still same issue :frowning:

In the meantime, just want to ask what is the difference with “Microsoft OAuth2 API” version ? I tried it but I’m struggling with the scope field which I don’t have to with the Excel one…

Hm, that’s what I did (step by step description linked in my last response) without any problems. So, it seems n8n is unable to parse the data Microsoft is passing on in the callback to your n8n instance, but the lack of logging here makes it hard to see what that might be. I know @RicardoE105 has worked a lot with n8n’s OAuth2 logic in the past, perhaps he has an idea what could be wrong?

I tried using MacOS install and got a different error but at least more verbose :slight_smile:

{"code":0,"message":"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).","hint":"","stack":"Error: Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).\n    at getAuthError (/Applications/n8n.app/Contents/Resources/app/node_modules/client-oauth2/src/client-oauth2.js:122:15)\n    at /Applications/n8n.app/Contents/Resources/app/node_modules/client-oauth2/src/client-oauth2.js:276:21\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async /Applications/n8n.app/Contents/Resources/app/node_modules/n8n/dist/src/credentials/oauth2Credential.api.js:170:28"}

Not sure it might be the same root cause though.

Btw what about those parameters in Azure ?

Hey @NickFR, it seems the option from your screenshot refers to single sign-on/sign-off logic not supported by n8n.

The desktop version would unfortunately not have received the aforementioned fix yet as it is currently using [email protected]. To use the very latest version of n8n, you might want to consider sticking to Docker. That said, there is also another fix for OAuth2 problems on its way which should go out with the next release: Scope parameter is not sent with my Oauth2 API credentials - #11 by Jon

1 Like

Hi,

Just upgraded to 0.208.1 and its connecting now.

Thanks!

1 Like

Amazing, thanks for confirming!

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