CI_JOB_TOKEN gives 401 on api/v4/groups/:id/projects call?

I thought the CI_JOB_TOKEN has the same access as the user triggering the job. With my personal access token it works, but it fails when using CI_JOB_TOKEN

curl -s --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "" {"message":"401 Unauthorized"}

  • *GitLab 13.2.4
  • *Runner 13.2.1
  stage: versions
    - 'curl -s --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" ""'

Hi @oschrenk,
as stated in the documentation:

GitLab API cannot be used via CI_JOB_TOKEN but there is a proposal to support it.

Ah. What a pity and what a jungle of tickets have been created in pursuit of this. I’ll just have to work around for the time.

Thank you for the answer and the link.

1 Like