Troubleshooting Oauth access token issues with Spokes


Instructions

Please note OAuth through mid server is not supported as of the date this KB was written.

If the  outbound call is going through mid server ,the call is not seen in outbound http log

1) Set the system properties as shown in the below screenshot

a) Filter navigator -> sys_properties.list

glide.outbound_http_log.override.level  = all

glide.outbound_http.content.max_limit = 1000

glide.outbound_http_log.override = true



2) Reproduce the issue by executing the flow

3) Filter Navigator -> Outbound HTTP Requests

Locate the outbound call that was made

Open the log record . Check the "Request" and "Response" tabs

Request:



Response:


In the above example an outbound call was made with header

authorization=Bearer <access_token>

and response was:

"Insufficient privileges to complete the operation"

This indicates that there was some permission issue with the access_token . To confirm this you can run the same test from 3rd party client like POSTMAN Rest as described below

1. Copy the URL , Request Body and token value from the Outbound HTTP log above

2. In POSTMAN

a)URL = URL from above Outbound HTTP Log

b)Authorization = No Auth

c)Header  

key = authorization

value = Bearer <access_token_from_outbound_http_log>

body = raw (json) , request body copied from above



c) Send the request and check for the response



You can see that similar issue/error was observed from POSTMAN as well .

This indicates that there is some scope/permission issue with the access_token.

Work with the end point provider to add the necessary scopes (in ServiceNow Oauth profiles) and run similar tests to confirm that this is working . Test this by running the test from POSTMAN first to confirm that you are able to access the required resources using the token that was generated .

Revert the sys_properties back once the troubleshooting is done.