Ansible Tower API不接受令牌

时间:2018-05-07 13:48:33

标签: ansible ansible-tower ansible-awx

我在POST服务器中执行以下Tower

http://<my-tower-url>/api/v2/job_templates/10/launch/


Headers:
Content-Type:application/json
Authorization:sometokenhere

找回错误:

  

{“detail”:“未提供身份验证凭据。”}

还尝试了以下内容:

Headers:
Content-Type:application/json
Authorization:Token sometokenhere

建议here

POST正文中传递原始用户名/密码时,如下所示(并跳过Authorization标题):

{
    "username": "myusername",
    "password": "mypass",
    "inventory": "inventoryname",
    "verbosity": 0,
    "extra_vars": {
        "var1": "somevar1",
        "var2": "somevar2",
        "var3": "somevar3",
        "var4": "somevar4",
        "var5": "somevar5"
    }
}

知道为什么这不起作用吗?

1 个答案:

答案 0 :(得分:0)

Authorization: Bearer <oauth2-token-value>

See here,“ 3。OAuth 2令牌认证”部分,“卷曲示例”部分。