Generating long-lived API tokens for CI/CD pipelines via Genesys Cloud REST API

We’re trying to automate the deployment of our custom agent desktop widgets using the Embeddable Client App SDK in our Jenkins pipeline. The current setup relies on short-lived OAuth tokens that expire every 3600 seconds, which causes the build to fail halfway through if the deployment takes longer than an hour. We need a way to generate a long-lived API token programmatically during the pipeline run so we can authenticate the SDK without manual intervention.

I’ve checked the documentation and found that we can use the client credentials grant flow. Here’s the curl command I’ve been using to test this locally:

curl -X POST "https://api.mypurecloud.com/api/v2/oauth/token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "grant_type=client_credentials&client_id=OUR_CLIENT_ID&client_secret=OUR_CLIENT_SECRET&scope=webchat:read webchat:write"

This works fine and returns a token, but the expires_in field is still 3600. I read somewhere that we can increase the token lifetime by adding a duration parameter, but it doesn’t seem to be working. I tried adding &duration=7200 to the request body, but the response is identical. The token still expires after an hour.

Is there a specific scope or configuration needed to enable longer token lifetimes? Or is there a different endpoint we should be using for CI/CD purposes? We’re using the Genesys Cloud REST API v2 and the pipeline runs on a Linux agent.

Here’s the JSON response we’re getting:

{
 "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
 "token_type": "Bearer",
 "expires_in": 3600,
 "scope": "webchat:read webchat:write"
}

We need a token that lasts at least 24 hours to cover our nightly build and deployment windows. Any ideas on how to achieve this?