Unable to download repository as zip file with project access token


I want to set up a workload outside of gitlab that downloads the source of the main branch of a project.


Generate a project access token and use that token to access the Download as zip link

Using the user interface, navigate to the project and find the link that downloads the repository as a zip file. In our case something like this:


Attempt to download it with curl and a personalized access token (e.g. a token bound to my user)

curl --header "PRIVATE-TOKEN: <<glpat-*****>>" https://gitlab.com/group/sub-group/project/-/archive/master/project-master.zip

Confirm that this works. Actually, confirming requires adding the -o option but that hides the ouput in the cli if it fails.

The Personal Access Token has read_api permissions and I am currently Developer on the project

Create a Project Access Token with read_api permission in Developer

Attempt with the same curl command, but use the Project Access Token instead of the Personal Access Token.

Observe a redirect to the SSO Login page

Expected behaviour

Project Access Tokens to work the same as Personal Access Token on project api endpoints

Never mind: I found later that this API works better https://gitlab.com/api/v4/projects/<project_id>/repository/archive

How about Groups like https://gitlab.com/api/v4/groups/group_id/repository/archive, for zip archiving download purpose?