# Basic auth, get OAuth2 required

**URL:** https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117
**Category:** Product Support
**Created:** [January 10, 2017, 5:28pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117 "2017-01-10T17:28:43Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![brandner](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brandner/32/153_2.png) [@brandner](https://forum.mautic.org/u/brandner)
#### Post date: [January 10, 2017, 5:28pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/1 "2017-01-10T17:28:43Z")

</div>

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](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?

---

<div class="post-metadata">

### Author: ![brandner](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brandner/32/153_2.png) [@brandner](https://forum.mautic.org/u/brandner)
#### Post date: [January 10, 2017, 5:28pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/2 "2017-01-10T17:28:43Z")

</div>

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](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](http://pasteboard.co/ksPgC3tYt.png)

Any suggestions?

---

<div class="post-metadata">

### Author: ![brandner](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brandner/32/153_2.png) [@brandner](https://forum.mautic.org/u/brandner)
#### Post date: [January 12, 2017, 5:28pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/3 "2017-01-12T17:28:34Z")

</div>

Anyone else using basic authentication?

---

<div class="post-metadata">

### Author: ![brandner](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brandner/32/153_2.png) [@brandner](https://forum.mautic.org/u/brandner)
#### Post date: [January 12, 2017, 5:58pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/4 "2017-01-12T17:58:31Z")

</div>

I think at least part of my problem was a bad .htaccess file.  
Note that I could not navigate to [http://SERVER/api/contacts](http://SERVER/api/contacts) but I could to [http://SERVER/index.php/api/contacts](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](http://SERVER/api/contacts) I no longer get a 404.

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

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

---

<div class="post-metadata">

### Author: ![brandner](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brandner/32/153_2.png) [@brandner](https://forum.mautic.org/u/brandner)
#### Post date: [January 12, 2017, 7:32pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/5 "2017-01-12T19:32:32Z")

</div>

Fixed. Was searching through docs and was reminded about the troubleshooting page:  
[https://mautic.org/docs/en/tips/troubleshooting.html](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.

---

<div class="post-metadata">

### Author: ![namratasaun](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/namratasaun/32/2801_2.png) [@namratasaun](https://forum.mautic.org/u/namratasaun)
#### Post date: [April 30, 2021, 10:52am UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/6 "2021-04-30T10:52:34Z")

</div>

> [@brandner](#):
>
> [Pasteboard - Uploaded Image](http://pasteboard.co/ksPgC3tYt.png)

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

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [April 30, 2021, 12:02pm UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/7 "2021-04-30T12:02:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![namratasaun](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/namratasaun/32/2801_2.png) [@namratasaun](https://forum.mautic.org/u/namratasaun)
#### Post date: [May 1, 2021, 7:17am UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/8 "2021-05-01T07:17:50Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/13bb16a58d0098f70cf04706f901f247393c8fa3.jpeg)

what to choose here if i have selected basic auth?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [May 1, 2021, 8:16am UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/9 "2021-05-01T08:16:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![namratasaun](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/namratasaun/32/2801_2.png) [@namratasaun](https://forum.mautic.org/u/namratasaun)
#### Post date: [May 1, 2021, 8:23am UTC](https://forum.mautic.org/t/basic-auth-get-oauth2-required/7117/10 "2021-05-01T08:23:05Z")

</div>

oh yes. It worked.  
thanks a lot @joeyk
