Hello everyone,
I’m setting up an n8n workflow that requires OAuth with Microsoft, but I’m encountering difficulties with redirect URIs.
Context
I have deployed n8n in a Docker container on an Ubuntu VPS with IP ABC. n8n is working correctly on http://ABC:5000.
Problem:
I cannot add the internal http:// URL in Azure as a redirect URI since Microsoft only accepts HTTPS redirects and HTTP://localhost.
So how do we handle this? Has anyone else encountered the same issue?
Here’s what I’ve done in more detail, which might be helpful:
- I configured a ngrok tunnel to obtain an HTTPS URL, tunnel installed and functional:
https://bla-bla-bla.ngrok-free.app
→http://ABC:5000
(working) - Also configured n8n to use the ngrok URL in a .env file
N8N_SECURE_COOKIE=false
N8N_HOST=bla-bla-bla.ngrok-free.app
N8N_PROTOCOL=https
N8N_PORT=443
N8N_WEBHOOK_URL=https://bla-bla-bla.ngrok-free.app/
- And I was able to add this ngrok HTTPS redirect URI in my Azure app Problem: The OAuth Redirect URL automatically generated by n8n in the interface, which of course is not modifiable… seems to “overwrite” my ngrok URL. And so inevitably:
AADSTS50011: The redirect URI '<http://ABC:5000/rest/oauth2-credential/callback>' specified in the request does not match the redirect URIs configured for the application
I’ve also tried:
- Restarting the container
- Adding
N8N_OAUTH_CALLBACK_URL
to environment variables - Verifying that configurations are being taken into account
- How can I force n8n to use the ngrok URL as the base for OAuth redirects?
- Are there specific configuration parameters that I might have missed?
- Is this a known issue with n8n and proxy/tunnel configurations?
Thank you