Skip to main content

Gitlab OAuth2 Authentication

note

This functionality is available starting from version 0.0.39. Make sure to upgrade before you use this.

To enable Gitlab OAuth2 you must register your application with Gitlab. Gitlab will generate a client ID and secret key for you to use.

Create Gitlab OAuth keys#

First, you need to create a Gitlab Application. Follow these instructions:

  1. Go to your Gitlab, e.g https://gitlab.com/
  2. In the top-right corner, click your profile photo.
  3. Click "Edit profile".
  4. In the left sidebar, click "Applications".
  5. In "Name", type "Pyroscope".
  6. In "Redirect URI" type https://pyroscope.mycompany.com/auth/gitlab/callback. Make sure to replace https://pyroscope.mycompany.com with the URL of your Pyroscope instance.
  7. In "Scopes" section select "read_api" scope.
  8. Click "Save application".

For the most recent version of these instructions visit Gitlab's documentation.

Enable Gitlab OAuth in Pyroscope#

Specify the Client ID and Secret in the Pyroscope configuration file. For example:

auth:  # Specifies which role will be granted to a newly signed up user.  # Supported roles: Admin, ReadOnly. Defaults to ReadOnly.  # The parameter affects all authentication providers.  signup-default-role: Admin  gitlab:    enabled: true    client-id: CLIENT_ID    client-secret: CLIENT_SECRET    allowed-groups:      - mycompany      - myorganization
note

If you decided to enable the internal authentication provider and allow users to signup via the auth.internal.signup-enabled option, we strongly recommend you to set auth.signup-default-role to ReadOnly (the default value).

See the server configuration page for more details on the Pyroscope configuration file.

Restart the Pyroscope server. You should now see a Gitlab login button on the login page. You can now login with your Gitlab accounts.