Dealing with a very strange bug here with the CXone OAuth flow. I am implementing an automated schedule sync service using Python. The initial POST /oauth/token succeeds, returning a valid access token and a refresh_token. I store the expires_in value and set an internal timer to refresh 60 seconds before expiry.
When the timer fires, I call the refresh endpoint. The server responds with HTTP 401 Unauthorized. The error payload is minimal:
{
"error": "invalid_grant",
"error_description": "Token has expired"
}
I verified the refresh_token is being sent correctly in the body. My local server clock is synced via NTP. However, I suspect the CXone auth server and my app server have a clock skew exceeding the JWT validation window. The documentation here mentions a 5-minute tolerance, but this error happens immediately upon refresh.
- How do I verify the exact server time of the CXone auth endpoint programmatically?
- Is there a header or endpoint that returns the current server time to adjust my local clock?
- Should I be ignoring
expires_inand relying solely on 401 retries instead?