Oauth2 with Zapier

Your software
My Mautic version is: 2.15.1
My PHP version is: 7.2.24

Your problem

I am creating a new Mautic integration with Zapier developer platform to create an email. The goal is RSS/WordPress feed to create a Mautic segment email for each new post. Will make it much easier for my mailing list. However, I cannot get the Oauth2 to work. I’ve filled in all the correct parameters and it’s calling:

https://crm.example.com/mautic/api/oauth/v2/authorize?client_id=SECRET&state=SECRET&redirect_uri=https%3A%2F%2Fzapier.com%2Fdashboard%2Fauth%2Foauth%2Freturn%2FApp12345CLIAPI%2F&response_type=code&grant_type=authorization_code

To be clear, the I copied the URL directly and obfuscated it. The client ID, secret key, state, etc. are all being filled in correctly by Zapier, matching the Oauth2 credential I created in the app. Instead of being redirected to log in, I am getting:

{"errors":[{"message":"API authorization denied.","code":401,"type":"access_denied"}],"error":"access_denied","error_description":"API authorization denied. (erroranderror_descriptionare deprecated as of 2.6.0 and will be removed in 3.0. Use theerrors array instead.)"}

So it’s the right endpoint, but something must be off.

There are no errors in the log.

Steps I have tried to fix the problem:

I tried enabling and disabling the option for HTTP BASIC auth to no effect. Originally I didn’t have the URL correct (needed /mautic/api appended for my installation), but when I got it right it switched from the 404 page to the above error.

Obviously others have figured out Zapier integration for creating leads, so I’d be grateful if I could get a pointer to fix this. Maybe Oauth2 doesn’t work with Zapier and I’m forced to use BASIC?

Zapier-Mautic is HTTP Basic.

1 Like

Thank you very much for the suggestion. Best of luck in your crusade against the Super Friends.

I switched to HTTP BASIC and the error message HTTP status in the response changed from 401 to 404.

I then searched the forums for a solution to that, and surprisingly the answer was clear the cache:

https://www.mautic.org/docs/en/tips/troubleshooting.html

I manually deleted the files and tried again, and after some finagling with Zapier and testing in Postman, it worked.

I also created a separate API role and login account so it could be locked down for security reasons. Nice that that was an easy to use feature.

Now I don’t know if the caching problem was preventing Oauth2 from working, or it’s just impossible from Zapier. But this is good enough.

Try to stay away from Zappier integration as much as you can, they are not keeping up with Mautic as much as they should (in my opinion).

But if you decide to use them, test every possible scenario and make sure the data is treated the way it is supposed to be.

Thanks Yosu, appreciate your insight. I’m not actually trying to use the official Zapier connector to create leads, but create my own integration to create a segment emails from an RSS feed. Want my WordPress blog to power my mailing list.

For simple fields Zapier is very straightforward, but once you have to do something moderately complex - like the array of segment IDs - you have to delve into their JavaScript API and custom code it. My JS is as rusty as my PHP, so I’m going to try using either Talend Open Studio or write a Groovy script.

1 Like

Hello folks,

i´m using different Mautic installations and never had this issue with Zapier. Now i made a server setup for a client of mine and he has a lot of restricitions, that we had to work with. But Muatic now is running fast and fluently.
Unfortunately i have a similar issue like whyphilip with a different error message using Zapier:

We hit an error adding your new account

authentication failed: request to https://mautic.softwarepartner.net/api/contacts?limit=1&minimal=1 failed, reason: unable to verify the first certificate

  1. Make sure you click “Allow” or “Accept” on the permission popup
  2. Double check your Account has the correct permissions
  3. Check out our help docs for more information

Calling the url i get the same message as well:
{“errors”: [{“message”: “API authorization refused”, “code”: 401, “type”: “access_denied”}], “error”: “access_denied”, “error_description”: “API authorization refused ( error and error_description are deprecated as of 2.6.0 and will be removed in 3.0. Use the errors array instead.)”}

But in this case it seems to be a certificate problem that i don´t understand. I cleared the cache a few times, activated http basic and everything i found on different postings. No chance till now to get it running.

Does anyone have an idea how to solve this problem? Would be super great.

Thanks in advance, Alvaro