# Authenticating to the API via Basic Auth

**URL:** <https://forum.ansible.com/t/authenticating-to-the-api-via-basic-auth/27441>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [May 3, 2018, 4:59pm UTC](https://forum.ansible.com/t/authenticating-to-the-api-via-basic-auth/27441 "2018-05-03T16:59:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Hickok](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Matt\_Hickok](https://forum.ansible.com/u/Matt_Hickok)\
**Post date:** [May 3, 2018, 4:59pm UTC](https://forum.ansible.com/t/authenticating-to-the-api-via-basic-auth/27441/1 "2018-05-03T16:59:33Z")

</div>

Hello – I am trying to use the AWX API (v2) but got stuck when trying to authenticate.

It looks like the authtoken endpoint was removed and users now being told to use one of the alternate authentication methods, primarily OAuth. However, we are not able to use OAuth.

Instead I am trying to use basic auth but I’ve having troubles finding documentation on it. I am using postman and trying to authenticate with just username and password fields to localhost/login. I am receiving the following:

"CSRF verification failed. Request aborted.

You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.

If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for 'same-origin' requests."

I am completely new to using REST APIs as well as Ansible, so any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Matt\_Hickok](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Matt\_Hickok](https://forum.ansible.com/u/Matt_Hickok)\
**Post date:** [May 4, 2018, 2:14pm UTC](https://forum.ansible.com/t/authenticating-to-the-api-via-basic-auth/27441/2 "2018-05-04T14:14:03Z")

</div>

Nevermind, I figured it out. Just need to include the auth every time I make a request rather than trying to get a token.

---

<div class="post-metadata">

**Author:** ![Christian\_Adams](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@Christian\_Adams](https://forum.ansible.com/u/Christian_Adams)\
**Post date:** [May 4, 2018, 4:43pm UTC](https://forum.ansible.com/t/authenticating-to-the-api-via-basic-auth/27441/3 "2018-05-04T16:43:45Z")

</div>

Hi Matt,

I’m glad that you figured out the basic auth. For your information, you can use OAuth2 tokens through Postman, you will just need to issue your tokens on the AWX instance first. You can do this through the API at the `api/v2/tokens` endpoint. ([OAuth2 docs](https://github.com/ansible/awx/blob/devel/docs/auth/oauth.md)). Let me know if you have any other questions.

Thanks,  
Christian
