Awx: API Authentication

Created on 3 Jun 2018  路  5Comments  路  Source: ansible/awx

ISSUE TYPE
  • Bug Report
  • Documentation
COMPONENT NAME
  • API
SUMMARY

Running a POST /api/v2/authtoken returns {"detail":"The requested resource could not be found."}
Either the documentation is wrong at http://docs.ansible.com/ansible-tower/latest/html/towerapi/auth_token.html or their is something wrong with the api.

ENVIRONMENT
  • AWX version: 1.0.6.8
  • AWX install method: docker on linux
  • Ansible version: 2.5.2
  • Operating System: CentOS 7
  • Web Browser: Chromium
STEPS TO REPRODUCE

Either ran a GET or POST request to /api/v2/authtoken and it fails and come back with the following:

screenshot from 2018-06-02 23-31-30

EXPECTED RESULTS

It should return something similar to the below:

{ "token": "8f17825cf08a7efea124f2638f3896f6637f8745", "expires": "2013-09-05T21:46:35.729Z" }

ACTUAL RESULTS

{"detail":"The requested resource could not be found."}

ADDITIONAL INFORMATION

Most helpful comment

@adambirds the documentation you've referenced is for Ansible Tower 3.2. In newer versions of awx, we've replaced the auth token implementation with OAuth2 tokens. Take a peek at this documentation for an explanation on how to generate OAuth2 tokens:

https://github.com/ansible/awx/blob/devel/docs/auth/oauth.md

All 5 comments

@adambirds the documentation you've referenced is for Ansible Tower 3.2. In newer versions of awx, we've replaced the auth token implementation with OAuth2 tokens. Take a peek at this documentation for an explanation on how to generate OAuth2 tokens:

https://github.com/ansible/awx/blob/devel/docs/auth/oauth.md

{"detail":"Authentication credentials were not provided. To establish a login session, visit /api/login/."}

Any one get past this? Encountering {"detail":"Authentication credentials were not provided. To establish a login session, visit /api/login/."}

Even after following @ryanpetrello method

Hi,

Don't know if you're still stuck on this but I've just started using the API.

The posts to /api/v2/applications/ and /api/v2/tokens/ using basic auth, obviously the user has to have rights on the box. I used our admin account. The second post gives you the tokens then you use those as bearer tokens in subsequent requests.

The ID for organisation can be picked from the URL when browsing them, here the application ID is 3.

https://awx.test.co.uk/#/applications/3?application_search=page_size:10;order_by:name

so did you end up using the http://10.190.101.31/api/v2/auth for 3.7 version and were you able login and receive tokens?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

darkaxl picture darkaxl  路  3Comments

astraios picture astraios  路  3Comments

gamuniz picture gamuniz  路  3Comments

marshmalien picture marshmalien  路  3Comments

mwiora picture mwiora  路  3Comments