The user used to have an environment with just a master, and getting the user API token was done with a simple query to the master. After adding JOC with SSO, it is no longer possible to query the master directly with just username:password to retrieve the API token.
The ability to retrieve the API token is useful for applications that have no knowledge of how Jenkins works, and just want to provide their credentials(username:password) to execute a command.
- CloudBees Jenkins Enterprise - Operations Center (CJE-OC)
- CloudBees Jenkins Enterprise - Managed Master (CJE-MM)
- CloudBees Jenkins Platform - Operations Center (CJP-OC)
- CloudBees Jenkins Platform - Client Master (CJP-CM)
The JOC needs to be queried directly to retrieve the API token. This token will be usable across all connected client masters. An example can be found below.
curl -u '<user>:<password>' 'http(s)://<joc-host>:<port>/user/<user>/configure' | grep apiToken curl -u '<user>:<apiToken>' 'http(s)://<jenkins-master-host>:<port>/<job-trigger-path>'