Mautic Community Forums

Basic auth, get OAuth2 required

Trying out the Mautic API, both via code and via the Postman application.

When I try to make calls to http://SERVER/index.php/api/contacts with the basic authorization header, I get:

Code:
{ "error": "access_denied", "error_description": "OAuth2 authentication required" }

I have checked the API settings in Mautic to ensure that basic authentication is enabled.

Screenshot:
http://pasteboard.co/ksPgC3tYt.png

Any suggestions?

Trying out the Mautic API, both via code and via the Postman application.
When I try to make calls to http://SERVER/index.php/api/contacts with the basic authorization header, I get:

{ "error": "access_denied", "error_description": "OAuth2 authentication required" }

I have checked the API settings in Mautic to ensure that basic authentication is enabled.

Screenshot:
http://pasteboard.co/ksPgC3tYt.png

Any suggestions?

Anyone else using basic authentication?

I think at least part of my problem was a bad .htaccess file.
Note that I could not navigate to http://SERVER/api/contacts but I could to http://SERVER/index.php/api/contacts.
This lead me to think that perhaps the URL mapping was wrong.

I restored an original .htaccess from github, and checked that my base URL in the configuration was correct. Now, when I navigate to http://SERVER/api/contacts I no longer get a 404.

However, my GET requests with the basic authorization header give me a different error:

{"error":{"message":"Requested URL not found: /api/contacts","code":404}}

Fixed. Was searching through docs and was reminded about the troubleshooting page:
https://mautic.org/docs/en/tips/troubleshooting.html

I cleared the cache and it started working. I suspect it needed to be cleared after the changes I made for the base URL.