I am getting the following error when i try triggering a build using the following command:
curl http://jenkins_server:port/jenkins/job/job_name/build?token=token_name>
This works for me:
tokenuser = You need login with the user and check token config jenkins -> admin users
user = username
curl -XPOST --silent --show-error --user user:tokenuser "http://ipserver/jenkins/buildByToken/build?job=JOBNAME&token=7RJWiIwD5cW3S6QjwF7a"
Example:
curl -XPOST --silent --show-error --user desarrollador:b9611288e4159ea9fb7857faeadd06fe "http://ipserver/jenkins/buildByToken/build?job=DeployGF&token=7RJWiIwD5cW3S6QjwF7a"