401 Unauthorized after token refresh due to clock skew between servers

The refresh script grabs a new token but the call to /api/v2/users/me throws a 401 Unauthorized. Deployment box clock is running four minutes fast compared to Genesys auth. The exp claim looks fine but we’ve got a 401 anyway.

headers = {"Authorization": f"Bearer {new_token}"}
response = requests.get("https://api.mypurecloud.com/api/v2/users/me", headers=headers)
print(response.status_code)
  • Python 3.10 on Ubuntu container
  • Genesys Cloud us-east-1 region
  • NTP service stopped for debugging
  • Added manual clock offset but it still fails