Tsallake zuwa abun ciki
Localtonet Localtonet Dashboard

Wannan shafin bai samu a cikin Hausa tukuna ba. Ana nuna shi da Turanci.

Single Sign-On with GitHub

Needs Balance HTTP tunnels

Taimako kan wannan shafi
A wannan shafin 4 sassa
  1. Before you start
  2. Steps
  3. Register an OAuth app on GitHub
  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 GitHub account before they can open an HTTP tunnel. You register an OAuth app on GitHub, 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 GitHub account. To register the app for an organization, you need access to that organization's settings.

Steps #

  1. Register an OAuth app on GitHub #

    GitHub's own guide is Creating an OAuth app. In short:

    1. On GitHub, open the menu under your profile picture and select Settings, then Developer settings, then OAuth apps.
    2. Select New OAuth App. If you have no app yet, the button reads Register a new application.
    3. Fill in the form with the values below and select Register application.
    4. On the page of the new app, copy the Client ID, then select Generate a new client secret and copy the secret right away.
    GitHub fieldValue
    Application nameA name your visitors recognize. GitHub shows it when it asks them to authorize.
    Homepage URLA web address that describes the app, for example your website.
    Authorization callback URLhttp://auth.localtonet.com/auth/callback
    Enable Device FlowLeave it off.

    You do not select scopes on GitHub. The sign-in request names them: read:user and user:email. GitHub asks the visitor to approve them the first time they sign in.

  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 GitHub. You see it in the tunnel settings.
    Provider typeGitHub. Changing the type of a saved provider empties Client ID, so enter the client ID and the client secret again.
    ActiveOn
    Client IDThe client ID from GitHub.
    Client secretThe client secret from GitHub. It is never displayed after saving.

    Under Endpoints & callback the standard GitHub addresses are filled in automatically. Leave them as they are:

    FieldFilled-in value
    Authorization endpointhttps://github.com/login/oauth/authorize
    Token endpointhttps://github.com/login/oauth/access_token
    User info endpointhttps://api.github.com/user
    Callback path/auth/callback/github

    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 GitHub provider. Select Save.

    Anyone can create a GitHub account. Without a rule, every GitHub 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. GitHub asks you to authorize the app the first time. After that you are sent back to the tunnel and your service loads.

Troubleshooting #

GitHub reports a redirect URI mismatch

GitHub's error is redirect_uri_mismatch: "The redirect_uri MUST match the registered callback URL for this application." No callback URL of the OAuth app matches the address that was sent. Set Authorization callback URL on GitHub to exactly http://auth.localtonet.com/auth/callback.

A visitor is refused although their address is on the list

The default User info endpoint, https://api.github.com/user, may return no email address when the GitHub user has not set a public email in their profile. Ask the visitor to check which address is set as public email in their GitHub profile, and compare it with your lists.

"403 - Access Denied" after a successful GitHub 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.

Sign-in fails before or after GitHub's authorization page

Check the Client ID and the Client secret saved in Localtonet against the OAuth app. Paste the Client ID again, generate a new client secret on GitHub, paste it into the provider and select Save provider.

There is no GitHub button on the sign-in page

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

Taimako