Skip to main content

Github OAuth2 Authentication

note

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

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

Create Github OAuth keys#

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

  1. Go to https://github.com/
  2. In the upper-right corner of any page, click your profile photo, then click "Settings".
  3. In the left sidebar, click "Developer settings".
  4. In the left sidebar, click "OAuth Apps".
  5. Click "New OAuth App".
  6. In "Application name", type "Pyroscope".
  7. In "Homepage URL", type the full URL to your app's website.
  8. Optionally, in "Application description", type a description of your app that users will see.
  9. In "Authorization callback URL", type https://pyroscope.mycompany.com/auth/github/callback. Make sure to replace https://pyroscope.mycompany.com with the URL of your Pyroscope instance.
  10. Click "Register application".
  11. Go to https://console.cloud.github.com/apis/credentials.
  12. Click "Create Credentials", then click "OAuth Client ID" in the drop-down menu.

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

Enable Github 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  github:    enabled: true    client-id: CLIENT_ID    client-secret: CLIENT_SECRET    allowed-organizations:      - 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 Github login button on the login page. You can now login with your Github accounts.