Trying to set up a secure auth flow for a CI/CD pipeline that runs script validations. We don’t want to hardcode client secrets. The goal is a token that lasts longer than the default 3600 seconds, ideally valid for the whole build window or longer if possible.
Tried hitting the standard /oauth/token endpoint with client credentials. Got a 200 OK, but the expires_in is stuck at one hour. The pipeline fails halfway through when the token drops.
- Endpoint:
POST /oauth/token - Grant type:
client_credentials - Scope:
admin:script:read - Response:
access_tokenpresent,expires_in3600
Checked the API docs and they mention custom grants or extended lifespans for service accounts, but the examples are vague. Is there a specific parameter to extend the TTL? Or do we need to implement a refresh loop in the pipeline script?
Here is the basic curl request we are using:
curl -X POST 'https://platform.nicecxone.com/oauth/token' \
-d 'grant_type=client_credentials&client_id=MY_ID&client_secret=MY_SECRET&scope=admin:script:read'
The response is standard. No errors, just short life. Any ideas on how to tweak this for a pipeline context?