Book Image

GitLab Cookbook

By : Jeroen van Baarsen
Book Image

GitLab Cookbook

By: Jeroen van Baarsen

Overview of this book

Table of Contents (16 chapters)
GitLab Cookbook
About the Author
About the Reviewers

Getting your private token for the API

GitLab has a powerful API system; almost all the actions you can perform in the web interface can also be done via the API. In order to use the API, you need to get your private token from GitLab. In this recipe, we will see where you can find your token and how you can regenerate an existing token.

How to do it…

In the following steps, we will create our private token for the API:

  1. Log in to your GitLab instance.

  2. Click on Profile settings.

  3. Click on Account.

  4. Here, you can find your private token:

  5. If you need to reset your token because it has been compromised, you can do so by clicking on the Reset button.

  6. GitLab will now generate a new token for you.

How it works…

The private token is used for all the API requests; it's a replacement for the username/password combination. You have to make sure that your private token is kept secure; the same way you have to make sure your username/password is secure.

When you have the feeling your token has been compromised, you...