Passwordless login for your self-hosted apps, confirmed in Telegram.
Put TeleLogin in front of any web app behind nginx, Traefik or Caddy and your users sign in by tapping a button in Telegram: no passwords to manage, no authenticator app to install. It runs on your server with your own bot, and also works as a small OpenID Connect provider.
Think of it as a lightweight alternative to Authelia or Authentik for when your users already have Telegram.
- A user opens your app. The reverse proxy asks TeleLogin whether the browser has a session; if not, it redirects to the TeleLogin login page.
- The user types their username. The page shows a two-digit number.
- Your bot sends them a Telegram message with the request's IP and browser, and a row of numbers plus a Deny button.
- They tap the matching number. The browser gets a session cookie and lands back on the app,
which receives the verified identity in
X-TeleLogin-Userheaders.
One confirmation signs the browser in to every app you connect, for 30 days by default. Number matching means a login you did not start cannot be approved by a careless tap: picking the wrong number denies the request.
- Forward auth for nginx, Traefik and Caddy: protect an app with a few lines of proxy configuration and no code in the app. Tested in CI against the real proxies.
- OpenID Connect provider: authorization code flow with PKCE, discovery and RS256 ID tokens, for apps that already support an OIDC login.
- Shared browser SSO across apps on the same host or on sibling subdomains.
- Per-app access control: allow specific users, or every registered user.
- Closed registration: users join only through invitations you create.
- Account management from Telegram: see recent logins and active sessions, revoke them, or delete the account.
- Raw API and JavaScript client if you want to build your own login UI.
- Small to run: two containers (API and bot), SQLite, images for amd64 and arm64.
TeleLogin is a good fit if you run a few self-hosted apps for yourself, your family or a small team, everyone already uses Telegram, and you want something simpler than a full identity provider.
Know its limits before you choose it:
- It depends on Telegram. If Telegram is down or blocked on your network, nobody can start a new login (existing sessions keep working until they expire). A user who loses their Telegram account has to be removed and invited again by the operator.
- There is no fallback method: no password, TOTP or WebAuthn.
- One instance, one worker. Data lives in SQLite and rate limits are kept in memory, so it does not scale horizontally.
- No groups, LDAP or SAML. Access is a per-app list of users. OIDC supports confidential clients only, with no consent screen (register only apps you trust), and ID tokens carry a username but no email address.
If you need any of those, Authelia or Authentik are the better tools.
You need Docker Compose v2, a domain served over HTTPS by a reverse proxy, and a Telegram account. Run these commands from the root of this checkout.
-
Create a bot. Talk to @BotFather, create a new bot and save its token and username (without
@). Dedicate the bot to TeleLogin: TeleLogin polls it for updates, so another program reading the same bot would steal them. -
Configure. Generate the two server secrets and create the environment file:
docker run --rm ghcr.io/downlevel/telelogin:2.0.0 python -m src.admin gen-secrets cp deploy/.env.example deploy/.env
In
deploy/.env, fill inBOT_TOKEN,BOT_USERNAME,SECRET_KEYandINTERNAL_API_KEY, and setPUBLIC_URLto TeleLogin's external HTTPS address, for examplehttps://auth.example.comorhttps://example.com/telelogin. KeepSSO_COOKIE_SECURE=true. SetREGISTRATION_MODE=closedif only invited users should be able to sign up. LeaveSSO_COOKIE_DOMAINempty unless apps on sibling subdomains must share the login, and then only if you trust every subdomain. See Configuration for every other setting. -
Start it.
docker compose -f deploy/docker-compose.yml up -d
The API listens on
127.0.0.1:8000on the host (API_PORTchanges the port). Proxy yourPUBLIC_URLto it, stripping any path prefix and blocking the internal endpoints, as shown in the proxy examples. If your proxy runs in Docker, follow Docker proxy networking instead: it removes the published port and joins the proxy to TeleLogin's network. -
Invite yourself.
docker compose -f deploy/docker-compose.yml exec --user 10001 api python -m src.admin user invite aliceThe command prints a single-use
https://t.me/...link, valid for 30 minutes (it sends no message). Open it in Telegram and press Start.aliceis your TeleLogin username, the one you type on the login page; it does not have to match your Telegram username. Once linked,user listshows your numerictelegram_id. If the link expired, runuser remove aliceand invite again. -
Register an app and allow yourself.
docker compose -f deploy/docker-compose.yml exec --user 10001 api python -m src.admin app add myapp --name "My App" docker compose -f deploy/docker-compose.yml exec --user 10001 api python -m src.admin app allow myapp alice
-
Protect the app. Copy the nginx, Traefik or Caddy snippet from the integration guide with app id
myapp, reload the proxy and open the app: you are sent to the login page, and a moment later your phone buzzes. Keep the app reachable only through the proxy, so nobody can bypass the check or forge the identity headers.
The admin commands run as the application user (--user 10001) so that files in the data volume
keep the right owner. For an app on another subdomain, or one that speaks OpenID Connect, read
Which mode do I need?
| I want to... | Read |
|---|---|
| Connect an app: forward auth, OpenID Connect, proxy examples | Integration guide |
| Manage users and apps | Operator CLI |
| Look up an environment variable | Configuration |
| Build a custom login UI | API reference and the JavaScript client |
| Understand the data model, threat model and privacy | Architecture and security model |
| Upgrade from 1.x | Upgrade steps: read them before starting 2.0.0 |
| Hack on TeleLogin | Contributing |
Questions and ideas are welcome in Discussions; bugs go in Issues. Please report vulnerabilities privately, as described in the security policy.
TeleLogin is distributed under the Apache License, Version 2.0. See LICENSE.