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.

How can you use just basic auth. When I select basic auth and then try to create API credential, I have to choose atleast 1 thing among Oauth 1.0 or oAuth 2.0

No, you can just use basic auth if you have API allowed. No extra setting. (Clear cache after allowing it.)

what to choose here if i have selected basic auth?

Nothing.Don’t add anything here. This is not Basic auth. Basic auth is user login/psw authenticated API call.

1 Like

oh yes. It worked.
thanks a lot @joeyk