Yeah so we’re seeing intermittent 401s (401) on the ServiceNow webhook pipeline - specifically when it tries to refresh the OAuth token. Took like 2 hrs to narrow it down, and it’s not the initial token exchange - that’s fine. It’s the /api/v2/oauth/token call after an incident’s closed, when it attempts to refresh for the next one.
Here’s the flow - kinda messy, I know.
[NICE CXone Incident Closed] --> [Webhook to ServiceNow] --> [Refresh OAuth Token] --> [ServiceNow API Call]
^
|
(intermittent 401)
The script’s basically doing this - using the CXone Platform API SDK v2.1.0:
import requests
def refresh_token(client_id, client_secret, refresh_token):
url = "https://api.nicexcxone.com/api/v2/oauth/token"
payload = {
'grant_type': 'refresh_token',
'refresh_token': refresh_token,
'client_id': client_id,
'client_secret': client_secret
}
response = requests.post(url, data=payload)
return response.json()
# ... other code ...
ServiceNow logs show the refresh token is valid, so it’s not the token itself. The API’s just straight-up refusing it some of the time. Seems random, but happens more frequently around 9am EST. Is anyone else seeing this, or am I going crazy?