Python SDK auto-refresh token not triggering on 401

Quick question about automatic token refresh in the Genesys Cloud Python SDK. My script hits a 401 Unauthorized error after 20 minutes, even though I’m using the genesyscloud client.

I assumed the SDK handles refresh tokens internally when passing a ClientConfiguration object. Instead, the request fails immediately.

Here is my setup:

config = ClientConfiguration(client_id=..., client_secret=..., private_key=...)
client = ClientConfiguration(config)

Do I need to manually catch the 401 and call client.auth.refresh_token()? I want to avoid manual loops.

Have you tried explicitly setting the refresh token strategy? The Python SDK doesn’t auto-refresh without a valid refresh_token in the config, unlike some browser-based OAuth flows. It defaults to static tokens unless told otherwise.

Initialize ClientConfiguration with the refresh token and enable auto-refresh. This forces the SDK to call /oauth/token on 401s.

config = ClientConfiguration(
 client_id="...",
 client_secret="...",
 refresh_token="...",
 refresh_token_strategy="auto"
)