Telegram Mini App Auth is sold separately on onlinepokerscript.com. This page is its technical reference; installing and configuring the plugin is covered in the Telegram Auth operator guide.
The @poker-addons/telegram-auth plugin (2.0, plugin API 1.4) lets players sign in from a Telegram Mini App. It registers the login provider telegram, a credential provider, with registry.auth.registerProvider (capability auth:provider). The plugin verifies Telegram’s initData; the engine’s provider-agnostic identity layer does the rest: finding or creating the account, the login guards, 2FA, linking, sessions. The plugin needs no Telegram code in core and has no routes of its own.
Upgrading from 1.0
| 1.0 | 2.0 | |
|---|---|---|
| Sign-in | POST /api/v1/plugins/telegram-auth/login | POST /api/v1/auth/external/telegram/credential { credential: { initData }, intent: 'login', mode } |
| Link / unlink | POST/DELETE /api/v1/plugins/telegram-auth/link, profile panel | Link: the credential endpoint with intent: 'link' (the plugin’s Settings → Telegram section, inside the Mini App). Unlink: core Settings → Sign-in methods (DELETE /api/v1/user/identities/telegram) |
| Set a first password | POST /api/v1/plugins/telegram-auth/password | intent: 'reauth' with the launch’s initData, then core’s POST /api/v1/user/identities/password { reauthTicket, newPassword } (the set-password form of Sign-in methods) |
| Status | GET /api/v1/plugins/telegram-auth/status | GET /api/v1/user/identities |
| Admin | Plugin page Telegram Accounts, user-detail fill, /admin/accounts routes | Core Players › Linked Accounts (filter by provider telegram), the Sign-in methods panel of the user drawer, Settings › Login Providers |
| 2FA accounts | The login button gave up ("use the standard login form") | The sign-in continues in the login page’s own 2FA step |
| Errors | TELEGRAM_* codes | Core codes: CREDENTIAL_INVALID (bad, expired or replayed initData), EXTERNAL_AUTH_NOT_LINKED, EXTERNAL_AUTH_ADMIN_FORBIDDEN, IDENTITY_*, PROVIDER_DISABLED |
| Data | telegram_accounts | user_identities (provider telegram) |
- The plugin routes are gone.
/login,/link,/password,/statusand/admin/*under/api/v1/plugins/telegram-authreturn 404 in 2.0. Bots, scripts or a custom Mini App that called them must post to the credential endpoint instead. - Accounts carry over. The engine’s migration
20261110000201_telegram_identitiescopied everytelegram_accountsrow touser_identities(providertelegram,provider_user_id= the Telegram id, username, display name, photo,profile { languageCode, isPremium, firstName, lastName };linked_viaauto_provisionstays,account_linkbecomeslink, anything elsemigration). A player created by 1.0 signs in through 2.0 to the same account. - Capability consent. 2.0 declares
auth:provider, which 1.0 did not. Upgrading an uploaded 1.0 asks the admin to grant it. - 1.0 keeps working until API 1.5. On this engine an installed 1.0 plugin still runs:
registry.auth.telegram.*is a deprecated shim reimplemented onuser_identities(it logs a one-time deprecation warning). The shim, the old verifier insrc/services/legacy-telegram/and thetelegram_accountstable are removed in plugin API 1.5, so upgrade before then.
Configuration
Configure the plugin from Extensions › Plugins: Settings on the Telegram Mini App Auth row.
| Setting | Default | Notes |
|---|---|---|
botToken | required | Telegram bot token used as HMAC key material. The provider is disabled (hidden, PROVIDER_DISABLED) until a token of the form 123456:ABC... is stored. |
maxInitDataAgeSeconds | 300 | Freshness window for auth_date, 30 to 86400. Payloads more than 60 seconds in the future are rejected. |
allowAutoProvision | true | The provider’s sign-up mode: on is auto (an unknown Telegram user gets an account at once), off is link_only (EXTERNAL_AUTH_NOT_LINKED until the player links Telegram). An admin override on the Login providers page wins. |
usernamePrefix | tg_ | provisioning.usernamePrefix: core’s fallback when the Telegram username is missing or taken (<prefix><6 digits>). |
botUsername | empty | Optional display metadata. |
Settings validation rejects syntactically invalid bot tokens, ages outside 30..86400 and invalid prefixes. After a save the plugin re-registers the provider (sign-up mode and prefix) and calls Telegram getMe with a five second timeout; it logs a warning if Telegram is unreachable or rejects the token, and never blocks the save.
The provider
{
kind: 'credential', id: 'telegram', displayName: 'Telegram',
button: false, // the plugin's fills post initData; core renders no button
platforms: ['web'],
trustEmail: false,
signupMode: allowAutoProvision ? 'auto' : 'link_only',
provisioning: { placeholderEmail: (i) => `tg_${i.providerUserId}@telegram.invalid`, usernamePrefix },
verifyCredential({ initData }, ctx) → ExternalIdentityInput,
}
verifyCredential returns providerUserId (the Telegram id), username, displayName (first and last name), firstName, lastName, avatarUrl (the Telegram photo, https only), locale, and profile { languageCode, isPremium, firstName, lastName }, the same fields the 1.0 data migration wrote. Telegram gives no email, so an auto-provisioned account gets the placeholder address (confirmed, never mailed) and a random unusable password (passwordSetAt = null) until the player sets one.
Security behaviour
initDatais verified in the plugin (src/server/init-data.ts, ported from the 1.0 verifier) with HMAC-SHA256 keyed withHMAC-SHA256("WebAppData", botToken)and a constant-time comparison.- Payloads over 8 KB, duplicate keys, missing
hash/auth_date, malformed user JSON, expired timestamps, future timestamps and HMAC mismatches are rejected. Every refusal reaches the client asCREDENTIAL_INVALID(401); the reason is only logged. - Replay protection: the plugin reserves
SHA-256(hash)for the freshness window withregistry.auth.reserveOnce(RedisSET NX EXwhen Redis is enabled, cluster-wide and failing closed; in memory on a single node).intent: 'reauth'skips it, so setting a first password inside the Mini App may present the launch’sinitDataagain within the window, as in 1.0. - The bot token is read fresh on every sign-in, so rotating it invalidates outstanding payloads at once.
- Core’s rules apply as for every provider: admin-group accounts are refused (
EXTERNAL_AUTH_ADMIN_FORBIDDEN), blocked/frozen, pending approval and email verification guards, the per-username login rate limit, 30 credential requests a minute per IP, 2FA for every account that has it, unlink can never remove the last credential, and admin unlink revokes sessions and is audited.
Frontend surfaces
The plugin client bundle registers:
- Login page fill (
auth.login.below-form): Continue with Telegram, only inside the Telegram WebView and only whileGET /api/v1/auth/providerslists thetelegramdescriptor. It posts{ credential: { initData }, intent: 'login', mode: 'cookie' }(plus the launch’sstart_paramas the referral code) and hands the result towindow.__pokerEngine.auth.continueExternalSignIn, which goes where the core finish page would: the lobby, or the 2FA step of the same login page. - Public page
/plugins/telegram-auth/public/mini-app: the Mini App’s start URL; signs in straight away the same way. It loadstelegram-web-app.jsitself when Telegram opened the page and nothing loaded it yet. - Settings section Telegram (
settings.sections,/settings#telegram): inside the WebView, Link Telegram (intent: 'link', session + CSRF) and, for an account without a password, Set a password (intent: 'reauth', then core’s set-password form in Sign-in methods). Outside Telegram it explains where to do it.
Linked accounts, unlinking and every admin view are core’s generic screens.