یہ صفحہ ابھی اردو میں دستیاب نہیں ہے۔ اسے انگریزی میں دکھایا جا رہا ہے۔
Single Sign-On with GitHub
Needs Balance HTTP tunnels
اس صفحے پر 4 سیکشنز
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 #
-
Register an OAuth app on GitHub #
GitHub's own guide is Creating an OAuth app. In short:
- On GitHub, open the menu under your profile picture and select Settings, then Developer settings, then OAuth apps.
- Select New OAuth App. If you have no app yet, the button reads Register a new application.
- Fill in the form with the values below and select Register application.
- 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 field Value Application name A name your visitors recognize. GitHub shows it when it asks them to authorize. Homepage URL A web address that describes the app, for example your website. Authorization callback URL http://auth.localtonet.com/auth/callbackEnable Device Flow Leave it off. You do not select scopes on GitHub. The sign-in request names them:
read:useranduser:email. GitHub asks the visitor to approve them the first time they sign in. -
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.
Field Value Provider name Any name, for example GitHub. You see it in the tunnel settings.Provider type GitHub. Changing the type of a saved provider empties Client ID, so enter the client ID and the client secret again. Active On Client ID The client ID from GitHub. Client secret The 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:
Field Filled-in value Authorization endpoint https://github.com/login/oauth/authorizeToken endpoint https://github.com/login/oauth/access_tokenUser info endpoint https://api.github.com/userCallback path /auth/callback/githubOptionally fill in Email access rules, then select Save provider.
-
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.
-
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.