OAuth2 authentication doesn't respect proxy setting

Describe the problem/error/question

When using a system wide proxy http_proxy and https_proxy, the OAuth authentication and token processes don’t respect the proxy settings. If I remove the authentication the HTTP (and other) nodes work fine and the requests show up in the proxy logs.

What is the error message (if any)?

In the case of authenticating against https://login.microsoftonline.com I see Error: connect ETIMEDOUT This is a Microsoft IP which as confirmed by a PCAP n8n tries to access directly instead of via the proxy.

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.229.0 & 0.227.0
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue/main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Rocky 8
1 Like

Dependent on library client-oauth2 which doesn’t support proxies. The repo hasn’t been updated in ~2.5 years and doesn’t seem like this PR will get merged - Use popsicle-proxy-agent to handle no proxy env by wlalele · Pull Request #85 · mulesoft-labs/js-client-oauth2 · GitHub

Looking at the latest master n8n now have their own (fork?) oauth2 library https://www.npmjs.com/package/@n8n/client-oauth2


Hey @pemontto,

I have created N8N-6420 as our internal ticket to look into this.


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