Documentation

Auth Token API Endpoint

Make a POST request to this resource with username and password fields to obtain an authentication token to use for subsequent request.

GET /api/v2/authtoken/

HTTP 200 OK
Allow: POST, DELETE, OPTIONS
Content-Type: application/json
Vary: Accept
X-API-Node: localhost
X-API-Time: 0.106s

{
    "detail": "Method 'GET' not allowed."
}

Example JSON to POST (content type is application/json):

{"username": "user", "password": "my pass"}

Example form data to post (content type is application/x-www-form-urlencoded):

username=user&password=my%20pass

If the username and password provided are valid, the response will contain a token field with the authentication token to use and an expires field with the timestamp when the token will expire:

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

Otherwise, the response will indicate the error that occurred and return a 4xx status code.

For subsequent requests, pass the token via the HTTP Authorization request header:

Authorization: Token 8f17825cf08a7efea124f2638f3896f6637f8745

The auth token is only valid when used from the same remote address and user agent that originally obtained it.

Each request that uses the token for authentication will refresh its expiration timestamp and keep it from expiring. A token only expires when it is not used for the configured timeout interval (default 1800 seconds).

Reviewing the Options Endpoint

The Options Endpoint table offers a view of the Options for this endpoint. When viewing the endpoint in the browsable API, clicking the “Options” button gives you the raw JSON for the following:

name Auth Token
description Make a POST request to this resource with `username` and `password` fields to obtain an authentication token to use for subsequent requests.
renders
0 application/json
1 text/html
parses
0 application/json
added_in_version 1.2
actions
POST
username
type string
required true
label Username
password
type string
required true
label Password

Copyright © 2017 Red Hat, Inc.

Red Hat Ansible Tower docs are generated using Sphinx using a theme provided by Read the Docs.