Skip to main content

GitHub

This document describes the use of GitHub as an identity provider for Pomerium. It assumes you have already installed Pomerium

caution

The GitHub API does not support OpenID Connect, just OAuth 2.0. For this reason, it was challenging to implement revocation of a user's Access Token (a string representing the granted permissions) when they sign out from Pomerium's user info endpoint.

In addition, the teams of the organization(s) a user belongs to, will be used as groups on Pomerium.

Create a GitHub OAuth 2.0 Application

  1. Log in to Github or create an account.

  2. Navigate to your profile using the avatar on the navigation bar, and select Settings:

  3. Navigate to Developer settings ➞ OAuth Apps and select New OAuth App.

    GitHub OAuth2 Application creation

  4. Create a new OAuth2 application by filling the form fields above with the following parameters:

    FieldDescription
    Application nameThe name of your web app.
    Homepage URLThe homepage URL of the application to be integrated with Pomerium.
    Authorization callback URLhttps://${authenticate_service_url}/oauth2/callback, authenticate_service_url from your Pomerium configuration.
  5. After creating the application, select Generate a new client secret and save Client Secret along with the Client ID.

Create a Service Account

To use allowed_groups in a policy, an idp_service_account needs to be set in the Pomerium configuration. The Service Account for GitHub should be a personal access token with read:org and user:email permissions.

  1. Create a new token at github.com/settings/tokens/new.

    Personal Access Token

  2. The format of the idp_service_account for GitHub is a base64-encoded JSON document:

    tmp.json
    {
    "username": "YOUR_GITHUB_USERNAME",
    "personal_access_token": "GENERATED_GITHUB_ACCESS_TOKEN"
    }

    You can save the object as a temporary file to encode:

    cat tmp.json | base64 -w 0

Pomerium Configuration

After creating your GitHub OAuth application, update the Pomerium configuration:

idp_provider: "github"
idp_client_id: "REDACTED" // github application ID
idp_client_secret: "REDACTED" // github application secret
idp_service_account: "REDACTED" // github service account (personal access token)

Whenever a user tries to access your application integrated with Pomerium, they will be presented with a sign-on page as below:

GitHub Sign-on Page