G
GitLab CLI (glab)
Details
- Command
-
glab - Docs
- https://docs.gitlab.com/cli/
Authentication
GitLab OAuth application (client ID + client secret) oauth2 discovered
$ glab auth login --web $ glab auth login --device Acquired by the CLI — running glab auth login --web opens the auth flow and stores the credential.
$ glab auth login --stdin In GitLab.com, open Personal access tokens, choose Generate token > Legacy token, set a name, expiration, and scopes such as read_api or api, then create the token and copy it before leaving the page.
GitLab CI/CD job token bearer discovered
$ glab auth login --job-token $CI_JOB_TOKEN Run the integration from a GitLab CI/CD job. GitLab exposes the token in the job environment as CI_JOB_TOKEN; docs note it only works for specific API endpoints. For glab, you can log in with glab auth login --job-token $CI_JOB_TOKEN or rely on CI auto-login where supported.