TgAuth2
Server-side Telegram authentication for NeoForge 1.21.1. Players verify via Telegram bot on every login with 12-hour device sessions.
# TgAuth — Telegram Authentication
> Server-side only. Players authenticate via Telegram on every login. No client mod needed.
`Join server
│
▼
Same device as last time? (IP-based session, valid 12 hours)
├── YES → Auto login, no Telegram needed ✅
└── NO → Bot sends confirmation to Telegram:
[✅ Yes] [❌ No]
│ │
Logged in ✅ Kicked ❌
1. Create a Telegram bot
Open @BotFather → `/newbot` → copy the token.
2. Get Telegram IDs of your players
Each player writes to @userinfobot → copies their `Id`.
3. Configure `config/tgauth-server.toml`
[bot]
botToken = "1234567890:AAH..."
botUsername = "MyServerAuthBot"
[whitelist]
telegramIds = ["123456789", "987654321"]
[session]
durationHours = 12
4. Restart the server. Done.
| Command | Description |
|---|---|
| `/tgauth link ` | Link Telegram account (new players) |
| `/tgauth status` | Show link status and active session |
| Command | Description |
|---|---|
| `/tgauth admin whitelist list` | List all whitelisted Telegram IDs |
| `/tgauth admin whitelist add
| `/tgauth admin whitelist remove
| `/tgauth admin unlink
| `/tgauth admin force
| `/tgauth admin sessions
| `/tgauth admin clearsessions
| `/tgauth admin reload` | Reload whitelist from config |
| | |
|---|---|
| Minecraft | 1.21.1 |
| Loader | NeoForge |
| Side | Server only |
| Java | 21+ |
Can players be on the same network?
Yes. The fingerprint combines IP + UUID, so two players from the same NAT have different fingerprints.
What happens if a player uses a VPN?
Their IP changes → session invalidated → Telegram confirmation required on next login.
Does this work with offline mode servers?
Yes, matching is done by UUID which NeoForge provides in both online and offline mode.
Is the bot token stored securely?
It lives in `config/tgauth-server.toml` on your server — keep that file private.