not authorized to list registries with CI_JOB_TOKEN

Summary

I would like to list registries using the CI_JOB_TOKEN. It is already possible with a normal API token. Trying to do this with CI_JOB_TOKEN results in 401 error.

Steps to reproduce

Add this to your pipeline:

curl --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" https://gitlab.noris.net/api/v4/projects/${CI_PROJECT_ID}/registry

see demo project here:

https://gitlab.com/oz123/demo-issue-with-token/-/jobs/222882034

$ curl --header "PRIVATE-TOKEN: ${CI_JOB_TOKEN}" https://gitlab.noris.net/api/v4/projects/${CI_PROJECT_ID}/registry/repositories/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    30  100    30    0     0   1039      0 --:--:-- --:--:-- --:--:--  1071
{"message":"401 Unauthorized"}$ 
Edited May 31, 2019 by Oz
Assignee Loading
Time tracking Loading