OAuth Authorization Error (MS Outlook OAuth2 API)

Describe the problem/error/question

I’m trying to connect Microsoft Outlook Account with the Microsoft Outlook OAuth2 API.

I was getting an OAuth Authorization Error (see below), but suddenly it worked! I did not change any setup, etc.

Thinking I was imagining things, I created another credential in Azure to try to link another (new) n8n MS Outlook credential to it. Again same error, for a few tries, then success !!!?

What is happening ? Am really puzzled.

The only error in the docker logs is:

User attempted to access a workflow without permissions

but that was there when starting up the docker container running n8n.

What is the error message (if any)?

None in docker logs,

n8n:

OAuth Authorization Error

There was a problem generating the authorization URL
Can’t connect to n8n.

Information on your n8n setup

  • n8n version:
    • 2.4.5
  • Database (default: SQLite):
    • postgres 16.4
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
    • default (not set)
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
    • self hosted docker
  • Operating system:
    • Ubuntu 22.04.5 LTS
1 Like

I just noticed that I can get it to work reliably if I:

  • Save the credential
  • Close the credential dialog box
  • Re-open the credential
  • THEN click on “Connect my account”

??? :thinking: ???

1 Like

Hey @Steve_L ,

You are not imagining it, this is a known quirk and it lines up with what you observed.

What is happening is that the Outlook OAuth credential UI sometimes tries to generate the authorization URL before the credential is fully persisted internally. When that happens, n8n cannot correctly build the OAuth state and you get the generic “There was a problem generating the authorization URL” error.

When you:

  • Save the credential

  • Close the dialog

  • Reopen it

  • Then click “Connect my account”

the credential is already stored and reloaded, so the OAuth flow works reliably.

This is a UI timing/state issue, not a Docker, Azure, or Outlook configuration problem. That is also why it appears random and why creating a new Azure app does not change anything.

The “User attempted to access a workflow without permissions” message in the logs is unrelated and can be safely ignored in this context.

Until this is fully fixed upstream, your workaround is the correct and recommended one. Let me know if this helps

2 Likes

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