lab
lab copied to clipboard
`lab token create` doesn't work on gitlab.com
My PATs are all expiring tomorrow, so – eager to try out the relatively new token create command – I tried:
❯ lab token create --expiresat 2025-05-13 --name 'Bot Token' --scopes api
2024/05/13 13:41:02 ERROR: token_create.go:74: POST https://gitlab.com/api/v4/users/111111/personal_access_tokens: 403 {message: 403 Forbidden}
It turns out that (if I understand correctly), this subcommand cannot work for gitlab.com, because:
- the "create a token for a user" endpoint is only available to server admins: "This API can only be used by GitLab administrators."
- the "create a token for the current user" is limited to only supporting the
k8s_proxyscope (which is not the one that I need)
Suggestion
It may be nice if this command errored early with a more helpful message when it's run in gitlab.com, perhaps with --force flag to allow it proceed in case you really do just need the k8s_proxy scope.