Authenticating to the API via Basic Auth

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!

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

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). Let me know if you have any other questions.

Thanks,
Christian