Skip to content

Commit

Permalink
Clarified CI Job Token auth. caveats
Browse files Browse the repository at this point in the history
See issue #1620
  • Loading branch information
axl89 committed Oct 7, 2021
1 parent 7753fa2 commit 746c25f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/api-usage.rst
Expand Up @@ -29,14 +29,16 @@ To connect to GitLab.com or another GitLab instance, create a ``gitlab.Gitlab``
gl = gitlab.Gitlab('https://gitlab.example.com', oauth_token='my_long_token_here')
# job token authentication (to be used in CI)
# bear in mind the limitations of the API endpoints it supports:
# https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html
import os
gl = gitlab.Gitlab('https://gitlab.example.com', job_token=os.environ['CI_JOB_TOKEN'])
# Define your own custom user agent for requests
gl = gitlab.Gitlab('https://gitlab.example.com', user_agent='my-package/1.0.0')
# make an API request to create the gl.user object. This is mandatory if you
# use the username/password authentication.
# use the username/password authentication (not required for job token authentication).
gl.auth()
You can also use configuration files to create ``gitlab.Gitlab`` objects:
Expand Down

0 comments on commit 746c25f

Please sign in to comment.