Lumaktaw sa nilalaman
Localtonet Localtonet Dashboard

Wala pa ang page na ito sa Filipino. Ipinapakita ito sa Ingles.

Single Sign-On with GitLab

Needs Balance HTTP tunnels

Tulong sa pahinang ito
Sa page na ito 4 seksyon
  1. Before you start
  2. Steps
  3. Create an OAuth application in GitLab
  4. Add the provider in Localtonet
  5. Turn it on for a tunnel
  6. Test it
  7. Troubleshooting
  8. Related pages

Let visitors sign in with their GitLab account before they can open an HTTP tunnel. It works with GitLab.com and with a self-managed GitLab instance. You create an OAuth application in GitLab, add it to Localtonet as a provider, then turn it on for the tunnel.

Before you start #

  • An HTTP tunnel and Balance on your account. See the Single Sign-On overview.
  • A GitLab account on GitLab.com or on your own instance.
  • For a self-managed instance: its address must be reachable from the internet. Your visitors' browsers open its sign-in page, and Localtonet's sign-in host calls its token and user endpoints directly.

Steps #

  1. Create an OAuth application in GitLab #

    GitLab's own guide is Configure GitLab as an OAuth 2.0 authentication identity provider. An application can belong to a user, a group or the whole instance:

    OwnerWhere to create it
    Your userSelect your avatar, then Edit profile, then Access › Applications and Add new application.
    A groupOpen the group, then Settings › Applications.
    The instance (self-managed, administrators only)Admin › Applications and New application.

    Fill in the form and select Save application:

    GitLab fieldValue
    NameA name your visitors recognize. GitLab shows it when it asks them to authorize.
    Redirect URIhttp://auth.localtonet.com/auth/callback
    ConfidentialKeep it selected.
    Scopesread_user

    GitLab then shows the Application ID and the Secret. Copy both right away: GitLab shows the secret only immediately after the application is created.

    The read_user scope gives read access to the profile of the signed-in user through the /api/v4/user endpoint, which is the User info endpoint Localtonet fills in. It is the only scope the sign-in requests, so the application needs no other scope.

  2. Add the provider in Localtonet #

    Open My Tunnels › HTTP and select SSO at the top of the page. In the SSO providers dialog, select Add provider.

    FieldValue
    Provider nameAny name, for example Company GitLab. You see it in the tunnel settings.
    Provider typeGitLab. Changing the type of a saved provider empties Client ID, so enter the client ID and the client secret again.
    ActiveOn
    Client IDThe Application ID from GitLab.
    Client secretThe Secret from GitLab. It is never displayed after saving.

    Open Endpoints & callback. The addresses of GitLab.com are filled in automatically. For a self-managed instance, replace gitlab.com with the host name of your instance in the first three fields.

    GitLab.com

    FieldFilled-in value
    Authorization endpointhttps://gitlab.com/oauth/authorize
    Token endpointhttps://gitlab.com/oauth/token
    User info endpointhttps://gitlab.com/api/v4/user
    Callback path/auth/callback/gitlab

    Self-managed

    FieldValue to enter
    Authorization endpointhttps://<YOUR_GITLAB_HOST>/oauth/authorize
    Token endpointhttps://<YOUR_GITLAB_HOST>/oauth/token
    User info endpointhttps://<YOUR_GITLAB_HOST>/api/v4/user
    Callback path/auth/callback/gitlab (unchanged)

    The Redirect URI in the GitLab application stays the Localtonet address from step 1. It does not contain your GitLab host.

    Optionally fill in Email access rules, then select Save provider.

  3. Turn it on for a tunnel #

    Under Your tunnels, select Settings on the tunnel, then Manage next to SSO Providers. In the Single sign-on dialog, turn on Require sign-in and the switch of your GitLab provider. Select Save.

    On GitLab.com anyone can create an account. Without a rule, every GitLab.com user who knows the address can open the tunnel. Fill in Who can sign in on the tunnel, or Allowed email domains on the provider. The lists are explained in the overview.

  4. Test it #

    Open the tunnel URL in a private browser window. Localtonet shows Sign in to continue with a button for your provider. GitLab asks you to authorize the application the first time. After that you are sent back to the tunnel and your service loads.

Troubleshooting #

GitLab says the redirect URI included is not valid

No Redirect URI of the GitLab application matches the address that was sent. Enter exactly http://auth.localtonet.com/auth/callback as the Redirect URI of the application.

GitLab says the requested scope is invalid, unknown, or malformed

A scope that was requested is not selected in the GitLab application. Edit the application and select read_user.

GitLab says the client authentication failed

The Client ID or the Client secret saved in Localtonet does not match the GitLab application. Paste the Application ID and the Secret again and select Save provider. If you renew the secret in GitLab, the application stops working until you save the new secret in Localtonet.

Sign-in with a self-managed instance never completes

Check the three endpoints for typing mistakes and make sure the instance answers from the internet. If it uses HTTPS, it needs a certificate that public clients trust. An instance that is reachable only inside your network cannot be used.

"403 - Access Denied" after a successful GitLab sign-in

A Localtonet rule refused the account. Check Email access rules on the provider and Who can sign in on the tunnel. After you correct a rule, wait a minute and reload.

There is no GitLab button on the sign-in page

The provider is not turned on for this tunnel, or it is set to inactive. Check both.

Suporta