You need to sign in or sign up before continuing.
Programmatic access to private pages
Is it possible to access files hosted via GitLab Pages programmatically (e.g. using cURL from a CI job) when only project members are allowed to access Pages? When a project is "private", cURL downloads the GitLab login page (obviously). I tried sending basic auth credentials with the username gitlab-ci-token
and password $CI_JOB_TOKEN
, but this didn't help. I couldn't find any documentation about programmatic access to private Pages.
Proposed Approach:
We will use the Authorization
header for GitLab Pages calls. The minimum required scope for the token is read_api
.
curl --header "Authorization: Bearer [TOKEN]" [Pages Project URL]
Supported access token types:
here.
Documentation is availableEdited by Naman Jagdish Gala