# Oauth2 Integration with n8n Error: connect ECONNREFUSED

**URL:** https://forum.mautic.org/t/oauth2-integration-with-n8n-error-connect-econnrefused/30693
**Category:** Product Support
**Tags:** mautic-4
**Created:** [January 28, 2024, 8:01am UTC](https://forum.mautic.org/t/oauth2-integration-with-n8n-error-connect-econnrefused/30693 "2024-01-28T08:01:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![elmamot](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@elmamot](https://forum.mautic.org/u/elmamot)
#### Post date: [January 28, 2024, 8:01am UTC](https://forum.mautic.org/t/oauth2-integration-with-n8n-error-connect-econnrefused/30693/1 "2024-01-28T08:01:46Z")

</div>

My Mautic version is:  
My PHP version is: 4.4.9 - app/prod  
My Database type and version is: percona/percona-server:

My problem is: I keep trying to connect n8n to mautic over Oauth2 and it keeps failing, I am using docker images with fpm and percona, here is my docker-compose:

```auto
services:
  database:
    image: percona/percona-server:latest
    container_name: database
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "3306:3306"
    volumes:
      - database:/var/lib/mysql
    restart: always
    networks:
      - mauticnet
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --sql-mode=""

  mautic:
    container_name: mautic
    build: .
    volumes:
      - mauticdata:/var/www/html
      - /etc/ssl:/etc/ssl:ro
    environment:
      - MAUTIC_DB_HOST=root
      - MAUTIC_DB_USER=root
      - MAUTIC_DB_PASSWORD=root
      - MAUTIC_DB_NAME=root
      - MAUTIC_RUN_CRON_JOBS=true
      - MAUTIC_TRUSTED_PROXIES=["0.0.0.0/0"]
      - MAUTIC_INSTALL_FORCE=true

    restart: always
    networks:
      - mauticnet
    ports:
      - "443:443"

networks:
  mauticnet:
    name: mauticnet
    external: true

volumes:
  database:
  mauticdata:

```

I have also extended the Dockerfile:

```auto
FROM mautic/mautic:v4

ARG DOMAIN=mautic.example.com

#RUN [-z "$DOMAIN"] && echo "DOMAIN is required" && exit 1 || true

COPY ssl.conf /etc/apache2/sites-available/default-ssl.conf

RUN sed -i "s/DOMAIN/$DOMAIN/g" /etc/apache2/sites-available/default-ssl.conf

RUN a2enmod ssl && a2ensite default-ssl.conf

```

here is the ssl.conf file as well:

```auto
<IfModule mod_ssl.c>
        <VirtualHost *:443>
                DocumentRoot /var/www/html
                ServerName DOMAIN
          
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLEngine on

                # Intermediate configuration, tweak to your needs
                SSLProtocol all -SSLv2 -SSLv3
                SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
                SSLHonorCipherOrder on
                SSLCompression off

                SSLOptions +StrictRequire

                LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
                LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

                SSLCertificateFile /etc/ssl/server.crt
                SSLCertificateKeyFile /etc/ssl/server.key
        </VirtualHost>
</IfModule>

```

this error happens after I obtain the client secret and id and insert the redirect uri the provided n8n redirect uri and then try to connect, a page open’s up in chrome, asks for username, password and then when i hit them this error appears.

These errors are showing in the log:

```auto
#### Error: connect ECONNREFUSED ip:443

More details

Failed to connect. The window can be closed now.

```

Steps I have tried to fix the problem:

---

<div class="post-metadata">

### Author: ![mreckendonk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mreckendonk/32/13466_2.png) [@mreckendonk](https://forum.mautic.org/u/mreckendonk)
#### Post date: [December 30, 2024, 4:41pm UTC](https://forum.mautic.org/t/oauth2-integration-with-n8n-error-connect-econnrefused/30693/2 "2024-12-30T16:41:12Z")

</div>

Hello,

same here, not running inside a docker but a compose install with version 5.2.1

The API won’t connect, neither with OAuth or with username and password.

Struggeling to get it to work for a whole day.
