I cannot figure out the way how to simply retrieve all repositories for my user on gitlab.
I'm trying to use this npm package: https://www.npmjs.com/package/gitlab
So for gitlab: Repositories=Projects
Here is how I try to use the gitlab package:
options =
owned: true
simple: true
# membership: true
# maxPages: 1
# per_page: 1
try
projects = await gitlab.Projects.all(options)
printSuccess "checkAccess Success!"
log "typeof projects: " + typeof projects
log "projects.length: " + projects.length
olog projects
catch err
printError "checkAccess Error!"
olog service
olog err
return true
The request is a success. Just the projects is always an empty array.
The only way I receive projects is when I donot state owned:true
.
Then the request takes some time and returns any public projects it finds.
Funny is when stating membership:true
but not owned:true
it still returns an empty array...
Also funny is that when trying
users = await gitlab.Users.all()
it always fails with 403 Forbidden
.
I've created various accessTokens one of them even with access to all of the scopes. For all the same behaviour occurs.
I have created a private and a public repository for my user to test this. So it definately should find these.
I also assume that the accessTokens are not the problem, as I get "401 Unauthorized" when I use an invalid one and the empty array when I use my valid one.
Also I assume that my accessToken is identifying my user so gitlab should know that the task is to retrieve all projects within my users' scope which are owned by my user.
Does anyone know how it works. I really donot understand what is going on and why it just would not work. Also yet I did not find anything helpful inside the documentation: https://docs.gitlab.com/ee/api/projects.html