# N8n and Mautic 5 API nor OAuth 2 working

**URL:** https://forum.mautic.org/t/n8n-and-mautic-5-api-nor-oauth-2-working/34619
**Category:** Mautic 5 Install/Upgrade Support
**Created:** [January 3, 2025, 10:55pm UTC](https://forum.mautic.org/t/n8n-and-mautic-5-api-nor-oauth-2-working/34619 "2025-01-03T22:55:01Z")
**Posts on this page:** 4
**Page:** 1

<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: [January 3, 2025, 10:55pm UTC](https://forum.mautic.org/t/n8n-and-mautic-5-api-nor-oauth-2-working/34619/1 "2025-01-03T22:55:02Z")

</div>

**Your software**  
My Mautic version is: 5.2.1  
My PHP version is: 8.2  
My Database type and version is: MariaDB

**Your problem**  
My problem is: I have a Mautic instalation on a cPanel server with Litespeed ent, and a n8n instalation on another server with docker. When I use the API (username password) `curl -u "sazzzz_sse:dddsade6sbT" https://m.domain.com/api/contacts` on the cPanel it returns all information correct. When I use the same command on the other instance with n8n and the docker installed, I get a lot of text, but nothing useful.

When I start to use OAuth, the connection screen pops up, and I get a 403. no further information.

As Mautic works on Apache, it should work flawless on LiteSpeed, as a drop-in replacement for Apache.

These errors are showing in the log:  
403,

Steps I have tried to fix the problem:  
to much to mention after 3 days before writing here on the forum.

Many other connections “just” work, only this n8n connection not,

Does anyone has an idea how to fix it?

Thanks

---

<div class="post-metadata">

### Author: ![jonathandhn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jonathandhn/32/5737_2.png) [@jonathandhn](https://forum.mautic.org/u/jonathandhn)
#### Post date: [January 7, 2025, 5:26pm UTC](https://forum.mautic.org/t/n8n-and-mautic-5-api-nor-oauth-2-working/34619/2 "2025-01-07T17:26:19Z")

</div>

I’m using OpenLiteSpeed and Mautic and on another server, n8n ~~  
Docker~~ Podman with OpenLiteSpeed web proxy in front.

Last time (nov 22) I tried to use Litespeed Ent with Mautic, htaccess errors from the Mautic provided file made my Mautic non-working at all, did It works now? Did you adapt the code of the Mautic htaccess file? and so how?

I’m currently using Mautic API with Oauth2 and N8N with this setup, but you could still enable basic auth for the API while fixing the issue with Oauth2 (actually, if basic auth don’t works, it can be on the Mautic side (and rewrite rules) or on the N8N side and missing a working functional web socket proxy.

---

<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: [January 10, 2025, 7:34pm UTC](https://forum.mautic.org/t/n8n-and-mautic-5-api-nor-oauth-2-working/34619/3 "2025-01-10T19:34:44Z")

</div>

I’m running mautic on LiteSpeed ent and n8n as a docker container in another server, using npm (nginx proxy manager) for serving n8n on a subdomain.

I needed to comment out the first rules for the apache 2.4+ to be able to login to mautic.

I tried some other changes to the .htaccess file, but none of the worked.

Even the basic Authentication from mautic to n8n (login:pwd) does not work.

---

<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: [January 10, 2025, 7:51pm UTC](https://forum.mautic.org/t/n8n-and-mautic-5-api-nor-oauth-2-working/34619/4 "2025-01-10T19:51:09Z")

</div>

n8n is setup with Portainer and this is the docker compose I used

```auto
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest

    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - PROXY_SET_HEADER_AUTHORIZATION=true
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:
    external: true

```

LiteSpeed ent and/or OpenLitespeed work different
