We’re refactoring our backend services to use the official Genesys Cloud Python SDK (genesyscloud) instead of raw requests. Previously, we were manually handling the OAuth token lifecycle with a separate worker that fetched new access tokens from https://api-us-east-1.genesys.cloud/oauth/token before they expired.
Looking at the SDK documentation, the genesyscloud.auth.OAuthApplicationClient seems to have methods like refresh_token and get_token. I’m trying to figure out if the higher-level clients (like genesyscloud.conversations.ConversationsApi) automatically intercept 401 Unauthorized responses and trigger a token refresh under the hood, or if I still need to write wrapper logic to check expiration and call refresh_token explicitly before every batch of API calls.
Here is the basic setup I have:
from genesyscloud.auth import OAuthApplicationClient
from genesyscloud.conversations import ConversationsApi
auth_client = OAuthApplicationClient(
app_id=os.environ['GENESYS_APP_ID'],
app_secret=os.environ['GENESYS_APP_SECRET'],
env='US_EAST_1'
)
# Get initial token
auth_client.get_token()
conversations_api = ConversationsApi()
If I just start making calls with conversations_api.get_conversations(), will the SDK handle the refresh? Or do I need to periodically call auth_client.refresh_token() manually? The docs are a bit vague on the automatic retry behavior for auth failures.