Authenticate with client credentials
You can authenticate an external system against the automation orchestrator API by using the OAuth 2.0 client credentials grant flow.
Before you begin
- A project administrator has created a service account and a credential, and has provided you with the client ID and client secret.
- The external system has network access to the automation orchestrator API.
About this task
This flow enables machine-to-machine authentication without interactive user login. The external system sends its client credentials to the token endpoint and receives a short-lived JWT access token for subsequent API calls.
Procedure
Results
- Confirm that the API returns a successful response. A
200 OKstatus code indicates that the token is valid and the service account has the required permissions for the requested resource. - If you receive a
403 Forbiddenresponse, the service account does not have the required RBAC role for the requested action. Contact the project administrator to assign the appropriate role. For more information, see Assign RBAC roles to a service account.
Service account authentication error reference
Service account authentication can fail because of token expiration, incorrect credentials, or a disabled account. This reference covers error responses, expiration behavior, and troubleshooting steps.
Handle token expiration
Service account access tokens have a limited lifetime, as specified by the expires_in value in the token response. When the token expires, subsequent API requests return 401 Unauthorized.
To continue making API calls, request a new token by repeating the client credentials grant flow. No refresh tokens are issued for service accounts. Your integration should implement one of the following strategies:
- Proactive renewal: Track the token's expiration time and request a new token before the current one expires.
- Reactive renewal: Catch
401 Unauthorizedresponses and request a new token before retrying the failed request.
Error responses
All token endpoint errors use the application/problem+json format (RFC 9457). The token endpoint returns a generic 401 error for all authentication failures to prevent client ID enumeration.
The following conditions result in a 401 error:
- The client ID is not recognized.
- The client secret does not match the current or previous (non-expired) secret hash.
- The service account status is
disabled. - The service account has been deleted.
- The credential status is
disabled. - The credential has expired.
Troubleshooting
If authentication fails, check the following:
- Confirm that the
client_idandclient_secretvalues are correct and that no extra whitespace or line breaks were introduced during copy. - Verify that the service account status is
activeand that it has not been disabled or deleted. - Check that the credential has not expired. The
service_accounts.credential_max_lifetime_dayssetting controls the maximum lifetime. The default is 180 days. To view or change this value, expand System Administration in the navigation sidebar, click Settings, then open the Authentication tab. System Administration and Settings appear only if you have thesetting:readpermission. If the credential has expired, create a new credential or rotate the existing one to reset its expiration. - Ensure that the
grant_typeparameter is set toclient_credentials. - Check that the
Content-Typeheader is set toapplication/x-www-form-urlencoded. - Confirm that the external system has network access to the automation orchestrator API.