Using CI_JOB_TOKEN to use repository files API returns 404

Summary

When using CI_JOB_TOKEN to download another project's file using the repository file raw API HTTP error 404 returns.

Steps to reproduce

  1. Create two private projects.
  2. Add token access from one project to another.
  3. Create CI pipelines for one of the projects.
  4. Try to download a file using the following url ${CI_API_V4_URL}/projects/${project_id}/repository/files/${path}/raw?ref=master using curl headers JOB-TOKEN: ${CI_JOB_TOKEN}
  5. This results in a HTTP 404.

What is the current bug behavior?

Access declined by HTTP 404.

What is the expected correct behavior?

Download of the requested file.