Open source · self-hosted · Apache 2.0

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 number in Telegram. No passwords to manage, no authenticator app to install. It runs on your server, with your own bot.

A lightweight alternative to Authelia or Authentik for when your users already have Telegram.

How it works

Your reverse proxy asks TeleLogin about every request. Users without a session confirm the login on their phone, once, and then move freely between your apps.

Open the app

The proxy asks TeleLogin whether the browser has a session. If not, it redirects to the TeleLogin login page.

Enter a username

The login page shows a two-digit number.

Get a message

Your bot sends a Telegram message with the request's IP and browser, three numbers and a Deny button.

Tap the number

The browser gets a session cookie and returns to the app, which receives the verified identity in X-TeleLogin-User headers.

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.

Everything a small setup needs

Built for a handful of self-hosted apps and the people who use them.

Forward auth

Protect an app with a few lines of nginx, Traefik or Caddy 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

One session across apps on the same host or on sibling subdomains.

Per-app access control

Allow specific users on each app, or every registered user. Close registration so people join only through your invitations.

Account control in Telegram

Users see recent logins and active sessions, revoke them, or delete their account, all from the bot.

Small to run

Two containers (API and bot) and SQLite. Images for amd64 and arm64. A raw API and JavaScript client if you want your own login UI.

Connect apps your way

Most apps behind your own reverse proxy want forward auth: it needs no code in the app.

Forward auth

For apps on the same host or a trusted parent domain. The proxy checks every request and passes the user on in headers.

nginx, Traefik and Caddy examples →

OpenID Connect

For apps with a built-in OIDC login, or on an unrelated domain. Confidential clients with any standard library.

OIDC setup →

Raw API

For a custom login UI that manages its own tokens.

API reference →
# Caddy: protect app.example.com
app.example.com {
    route {
        # drop identity headers sent by clients
        request_header -X-TeleLogin-User
        request_header -X-TeleLogin-User-Id
        request_header -X_TeleLogin_User
        request_header -X_TeleLogin_User_Id
        forward_auth telelogin:8000 {
            uri /sso/verify?app=myapp&redirect=1
            copy_headers X-TeleLogin-User X-TeleLogin-User-Id
        }
        reverse_proxy myapp:8080
    }
}

Adapted from examples/caddy/Caddyfile, where TeleLogin itself is served on auth.example.com.

Is it for me?

TeleLogin does one thing simply. Here is where it fits, and where it does not.

A good fit if

  • You run a few self-hosted apps for yourself, your family or a small team.
  • Everyone already uses Telegram.
  • You want something simpler than a full identity provider.
  • Your apps sit behind nginx, Traefik or Caddy, or support OpenID Connect.

Know its limits

  • It depends on Telegram. If Telegram is down or blocked, nobody can start a new login; existing sessions keep working until they expire.
  • No fallback method: no password, TOTP or WebAuthn. A user who loses their Telegram account is removed and invited again.
  • One instance, one worker, SQLite and in-memory rate limits: no horizontal scaling.
  • No groups, LDAP or SAML. OIDC supports confidential clients only, and ID tokens carry a username but no email.

If you need any of those, Authelia or Authentik are the better tools.

Quick start

You need Docker Compose v2, a domain served over HTTPS by a reverse proxy, and a Telegram bot created with @BotFather and dedicated to TeleLogin. Run the commands from a checkout of the repository.

Configure

docker run --rm ghcr.io/downlevel/telelogin:2.0.0 \
  python -m src.admin gen-secrets
cp deploy/.env.example deploy/.env

Fill in BOT_TOKEN, BOT_USERNAME, the two secrets and PUBLIC_URL.

Start

docker compose -f deploy/docker-compose.yml up -d

Proxy your PUBLIC_URL to 127.0.0.1:8000, blocking the internal endpoints.

Invite yourself

docker compose -f deploy/docker-compose.yml exec \
  --user 10001 api python -m src.admin user invite alice

Open the printed link in Telegram and press Start.

Register and protect an app

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

Add the proxy snippet for myapp, open the app, and tap the number.