Trying to understand why my pre-request script for generating a long-lived API token via the /api/v2/oauth/token endpoint returns a 403 Forbidden error. I am using the client credentials flow with a service account that has integration:read and oauth:write permissions. The request body is standard:
grant_type=client_credentials
&client_id={{client_id}}
&client_secret={{client_secret}}
The response payload is:
{
"errors": [
{
"code": "invalid_grant",
"message": "Client authentication failed"
}
]
}
This works fine for short-lived tokens in my local Postman collection, but fails consistently in the Newman CLI run on our Jenkins server. I have verified that the environment variables are being resolved correctly by logging them (masked) before the request. Is there a specific scope or permission required for long-lived tokens that isn’t documented? Or is the service account being blocked due to IP whitelisting issues in the CI environment? My timezone is America/Toronto, and I am testing against the us-east-1 region.