This section explains how to configure GitLab as an SSO provider in Localtonet to protect your HTTP tunnels.
GitLab SSO works with both gitlab.com and self-hosted GitLab instances, as long as OAuth 2.0 is enabled.
GitLab SSO is recommended when:
Your team already uses GitLab accounts
You want to restrict tunnel access to GitLab users
You are using self-hosted GitLab (Enterprise / Community Edition)
You prefer OAuth-based authentication without external IdPs
Before adding GitLab as an SSO provider in Localtonet, you need to create an OAuth application in GitLab.
Go to: GitLab Applications
Go to:
https://<your-gitlab-domain>/-/profile/applications
Click New application.
Fill in the application details:
Name
Any descriptive name (e.g. Localtonet Tunnel SSO)
Redirect URI
http://auth.localtonet.com/auth/callback
Scope
✅ read_user
✅ openid
✅ email
✅ profile
Click Save application.
Copy the following values:
Application ID (Client ID)
Secret (Client Secret)

Open the SSO Providers section in your Localtonet account.
Click Add Provider.
Fill in the provider details:
Provider Name
Any descriptive name (e.g. GitLab, Company GitLab Login)
Provider Type
Select GitLab
Client ID
Paste the Application ID from GitLab
Client Secret
Paste the Secret from GitLab
Configure the OAuth endpoints.
Use the following endpoints:
Authorization Endpoint
https://gitlab.com/oauth/authorize
Token Endpoint
https://gitlab.com/oauth/token
UserInfo Endpoint
https://gitlab.com/oauth/userinfo
Replace the domain with your GitLab instance:
https://<your-gitlab-domain>/oauth/authorize
https://<your-gitlab-domain>/oauth/token
https://<your-gitlab-domain>/oauth/userinfo
Callback Path
/auth/callback/gitlab
(Optional) Configure Allowed Email Domains
Example: company.com
Only users with matching email domains will be allowed
Toggle Active to enable the provider.
Click Save.

Open the HTTP Tunnel Settings for the tunnel you want to protect.
Navigate to SSO Providers → Manage.
Enable SSO for this tunnel.
Toggle GitLab to activate it.
Configure optional tunnel-level settings:
SSO Path(s) – paths that require authentication
Logout Path – logout endpoint
Allowed Domains / Emails / Usernames – additional access rules
Click Save Changes.
When a user accesses the tunnel URL:
The request is intercepted by the Localtonet authentication layer.
The user is redirected to GitLab for authentication.
After successful login, the user is redirected back to the tunnel.
Access is granted if all provider and tunnel rules are satisfied.
Your local application does not handle authentication.
GitLab SSO uses OAuth 2.0 + OpenID Connect
Ensure the email scope is enabled
Self-hosted GitLab must allow OAuth applications
Use domain restrictions for company-only access
Rotate client secrets periodically
Invalid redirect URI
→ Ensure the callback URL matches exactly
Email not returned
→ Verify email scope is enabled
Access denied after login
→ Check domain/email restrictions in provider or tunnel settings