I have a Jenkins freestyle project, and have enabled “trigger builds remotely e.g. from scripts” with an authentication token. I’m trying to trigger the job, but I keep getting “Authentication required” with this error message:
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read
... which is implied by: hudson.security.Permission.GenericRead
... which is implied by: hudson.model.Hudson.Administer
I want a script to trigger this job, and I’m using Postman or curl to test the trigger now. So unauthenticated is good; security comes from using https and having a strong randomly generated authentication token.
On the project, I have enabled project-based security, and have granted all permissions to all Authenticated and Anonymous users. So I don’t understand why I keep getting that error message. I’ve also tried removing project-based security and confirm that the global anonymous read and build permissions are granted. So I really don’t understand why I keep getting this error.
When I enable “trigger builds remotely” it says: Use the following URL to trigger build remotely: JENKINS_URL/job/myjobname/build?token=TOKEN_NAME or /buildWithParameters?token=TOKEN_NAME
I browse to my job, in order to get the JENKINS_URL, and for TOKEN_NAME, I am using a randomly generated alphanumeric string, which is in the Jenkins job configuration, as Authentication Token, so the complete URL is (with real hostname, jobname, authentication token changed):
https://myhost.mydomain/job/myjobname/build?token=maWd5eBG3QPkBrzvmCzM