Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

OAuth Token error in REST Message

Dominik15
Tera Contributor

Hi,

I am trying to integrate Ansible with ServiceNow, however all the time I keep getting this error: oauth access or refresh tokens are not available. verify the oauth configuration and click the 'get oauth token' link below to request a new token. After clicking Get OAuth token I face error : Unauthorized - http 401 error.  I attatched config of my application registry. Can you kindly help me resolve the issue?

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, unfortunately a partial screenshot doesn't do much to assist diagnostics and a 401 error code doesn't indicate anything other than authentication failed.
Are you sure that your URL's\endpoints are correct?
Often api/ is followed by the API version and /o/ seems a little unusual?
Are you able to authenticate to the target platform using Postman or similar REST application?

Hi Tony, I have done everything as shown in this tutorial Ansible + ServiceNow Part 3: Making outbound RESTful API calls to Red Hat Ansible Tower up to step 12, where I can't get token. I believe url and endpoints are correct according to the tutorial, same goes for api/o/authorize.

Vasantharajan N
Tera Sage
Tera Sage

Please check this Ansible document and check you have configured the application for ServiceNow. 

https://docs.ansible.com/ansible-tower/latest/html/administration/oauth2_token_auth.html

find_real_file.png


Thanks & Regards,
Vasanth