Get Token
- name: “Get Token for {{ wwwurl }}”
hosts: all
connection: local
tasks:
- name: “Post to /mga/sps/oauth20/token”
uri:
url: “{{ wwwurl }}/mga/sps/oauth/oauth20/token”
method: POST
user: “******”
password: “******”
body: “client_id=mobile_client&grant_type=password&rememberDevice=N”
force_basic_auth: yes
output
PLAY [Get Token for https://mobile-api.*****.com] ****************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
ok: [mobile-api.*****.com]]
TASK [Post to /mga/sps/oauth20/token] *******************************************************************************************************************************************************************************************************
fatal: mobile-api..com]]: FAILED! => {“cache_control”: “no-store, no-cache=set-cookie”, “changed”: false, “connection”: “close”, “content”: "{"error":"mapping_error","error_description":"No username\/."}", “content_language”: “en-US”, “content_type”: “application/json;charset=UTF-8”, “date”: “Fri, 23 Jun 2017 16:25:03 GMT”, “expires”: “Thu, 01 Dec 1994 16:00:00 GMT”, “failed”: true, “json”: {“error”: “mapping_error”, “error_description”: "No username/*****."}, “msg”: “Status code was not [200]: HTTP Error 400: Bad Request”, “p3p”: “CP="NON CUR OTPi OUR NOR UNI"”, “pragma”: “no-cache”, “redirected”: false, “session_timeout”: “0”, “set_cookie”: “AMWEBJCT!%2Fmga!JSESSIONID=00003D9MH5B2YadZ4qTRenXJAJF:8ae44baf-46b7-4705-9c97-50e1231add00; Path=/; HttpOnly, PD_STATEFUL_d70a9cb6-5060-11e6-b1dd-005056be1e86=%2Fmga; Path=/”, “status”: 400, “url”: “https://a-mobile-api.cigna.com/mga/sps/oauth/oauth20/token”}
Any thing wrong with my request / Playbook?
Thanks,
Ram