Skip to main content
This guide shows you how to create a GitLab application and configure ngrok to use GitLab OAuth for user authentication. The steps below follow GitLab’s OAuth 2.0 setup documentation for web applications.

What you’ll need

  • A GitLab account.
  • Your ngrok authtoken and an endpoint with the OAuth action in its Traffic Policy.

Create an application

  1. Open your GitLab profile page and select Applications in the left menu.
Restricting sign-in: To limit which users can sign in with GitLab, create the application under one of your groups or as an instance-wide application. See Further resources for more detail.
  1. Enter a Name for your application and set Redirect URI to https://idp.ngrok.com/oauth2/callback.
  2. In the Scopes section, select the scopes appropriate for your app (for example, openid, profile, and email) and then click Save application.

Update your ngrok endpoint Traffic Policy

  1. Access the ngrok Dashboard Endpoints page and locate an existing endpoint you’d like to add this to or create a new one.
  2. In your traffic policy, add the following configuration:
You may add any scopes that are required by your application with the following caveats.
on_http_request:
  - actions:
      - type: oauth
        config:
          provider: gitlab
          client_id: '{your app''s oauth client id}'
          client_secret: '{your app''s oauth client secret}'
          scopes:
            - openid
            - profile
            - email
Click Save to validate and update your traffic policy.

Configure access control

Optionally, configure access control to your service by only allowing specific users or domains.
on_http_request:
  - expressions:
      - '!(actions.ngrok.oauth.identity.email in [''me@example.com''])'
    actions:
      - type: deny

Further resources