Problems with OAuth on DEV installation

Your software
My Mautic version is: 4.4.8
My PHP version is: 7.4
My Database type and version is:

Your problem
My problem is:
A quick question. I have Wordpress and Mautic on a localhost DEV server. Wordpress establishes a OAuth connection to Mautic and gets authenticated. But when doing the actual API request Mautic responds with 401 API authorization denied. Is there any problem when doing the OAuth request over an unsecure http connection, or do I have any other issue going on here?


New

3 minutes ago

Hi there!

The first thing to check is to make sure the API is turned on (ensure you clear the Mautic cache after turning on the API), the credentials are correct etc.

Also check you’re using the right URL for the Mautic instance etc.

If you’re using DDEV for Mautic you should have https - is there a reason for not having it?

The API is turned on and I created the token. WordPress was able to make the connection. Just at the moment to create the bearer token it fails.

I have not installed DDEV for Mautic, I just did installed it on a regular LAMP stack. So for the moment I have no SSL, and just wonder if that is causing the problem.

An additional detail. When requesting the bearer token I get the response: No refresh token parameter found, and in sequence, the API request without proper bearer token responds with: 401 API authorization denied.

Interestingly the same plugin on a life site is working, but on debugging I cannot get it do anything.

I think the problem is in wordpress, it must be on https, cloudflared tunnel did the trick for me.

alright, in this case I need to set up my entire dev environment with DDEV, is that the solution? With a Cloudflared tunnel you mean you configure your home computer to resolve to Cloudflare? That means that your IP address needs to be stable, which is not at all the case with my provider. The IP can change any second. Hope that DDEV will resolve my case, but it is some work to migrate everything

1 Like

I finally could install both wordpress and mautic under DDEV, but I have now a problem with authenticating. Terminating the process after granting the permission in Mautic, it has some hickup when returning to Wordpress and does not properly save the authorization. Hence I cannot make an API call at all. How do I troubleshoot such a scenario, involving both the WordPress plugin and Mautic?

I found out now that on generating the Access token right after the authorization process it creates the error:
“cURL error 60: SSL: no alternative certificate subject name matches target host name ‘mautic.ddev.site’”

So something going on with the certificates of DDEV?

I finally found out the solution, which is described here:

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