[PR #4932] [CLOSED] feat: add telegram provider #5669

Closed
opened 2026-03-13 12:31:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4932
Author: @blaconix
Created: 9/26/2025
Status: Closed

Base: canaryHead: pr-3634


📝 Commits (10+)

  • b367c1c docs: add telegram to sidebar
  • fd2882a docs: add initial documentation
  • 64401ea feat: add telegram profile type
  • bb4268d feat: add initial server and client plugins
  • 55d3c27 feat: add test file
  • d8c6fff fix: wording
  • 20edc26 Merge branch 'better-auth:main' into feat/telegram-login-widget
  • a529c94 fix: id comes as number from telegram
  • b78ca87 feat: added signIn for widget callback
  • 144c243 chore: add todos

📊 Changes

6 files changed (+784 additions, -1 deletions)

View changed files

📝 docs/components/sidebar-content.tsx (+25 -1)
docs/content/docs/plugins/telegram.mdx (+64 -0)
packages/better-auth/src/plugins/telegram/client.ts (+11 -0)
packages/better-auth/src/plugins/telegram/index.ts (+630 -0)
packages/better-auth/src/plugins/telegram/telegram.test.ts (+33 -0)
packages/better-auth/src/plugins/telegram/types.ts (+21 -0)

📄 Description

Summary by cubic

Adds a Telegram Login Widget plugin to Better Auth for sign-in and account linking, with secure payload verification, session creation, and a documented callback flow.

  • New Features
    • Server plugin with endpoints: sign-in, link, and callback.
    • Validates Telegram payloads via data-check-string + HMAC-SHA256 using the bot token; enforces a 5-minute auth_date expiry; returns clear error codes.
    • Finds existing accounts, creates users when needed, supports mapProfileToUser, and falls back to a deterministic email if none is provided.
    • Creates sessions and sets cookies; supports rememberMe; callback redirects with origin check.
    • Client plugin (telegramClient) for type-safe integration, new docs page, and sidebar entry; includes a test for expired auth_date.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4932 **Author:** [@blaconix](https://github.com/blaconix) **Created:** 9/26/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `pr-3634` --- ### 📝 Commits (10+) - [`b367c1c`](https://github.com/better-auth/better-auth/commit/b367c1caece902c02b7c3caf2585824f9587276a) docs: add telegram to sidebar - [`fd2882a`](https://github.com/better-auth/better-auth/commit/fd2882aa1a1774fb3355cc90587b0375556963d0) docs: add initial documentation - [`64401ea`](https://github.com/better-auth/better-auth/commit/64401eafd4552c7e5133d183e6b1aa175f6bce87) feat: add telegram profile type - [`bb4268d`](https://github.com/better-auth/better-auth/commit/bb4268d0ce35e80f5609d0e862f2131a61f9f5a3) feat: add initial server and client plugins - [`55d3c27`](https://github.com/better-auth/better-auth/commit/55d3c2707a0398d1c8a175d393ddf15995b4832d) feat: add test file - [`d8c6fff`](https://github.com/better-auth/better-auth/commit/d8c6fffb46630ecc65999161a52b78eec722f01a) fix: wording - [`20edc26`](https://github.com/better-auth/better-auth/commit/20edc268df72c82ae5ead19fc486324e697f22da) Merge branch 'better-auth:main' into feat/telegram-login-widget - [`a529c94`](https://github.com/better-auth/better-auth/commit/a529c94fe08fe05496399f61175cbeee6c08615e) fix: id comes as number from telegram - [`b78ca87`](https://github.com/better-auth/better-auth/commit/b78ca875b6ed3581725788f7a3d06025d8a6516c) feat: added signIn for widget callback - [`144c243`](https://github.com/better-auth/better-auth/commit/144c24375c24dff7c3ffc3e5a8befeafe02937ac) chore: add todos ### 📊 Changes **6 files changed** (+784 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/sidebar-content.tsx` (+25 -1) ➕ `docs/content/docs/plugins/telegram.mdx` (+64 -0) ➕ `packages/better-auth/src/plugins/telegram/client.ts` (+11 -0) ➕ `packages/better-auth/src/plugins/telegram/index.ts` (+630 -0) ➕ `packages/better-auth/src/plugins/telegram/telegram.test.ts` (+33 -0) ➕ `packages/better-auth/src/plugins/telegram/types.ts` (+21 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds a Telegram Login Widget plugin to Better Auth for sign-in and account linking, with secure payload verification, session creation, and a documented callback flow. - **New Features** - Server plugin with endpoints: sign-in, link, and callback. - Validates Telegram payloads via data-check-string + HMAC-SHA256 using the bot token; enforces a 5-minute auth_date expiry; returns clear error codes. - Finds existing accounts, creates users when needed, supports mapProfileToUser, and falls back to a deterministic email if none is provided. - Creates sessions and sets cookies; supports rememberMe; callback redirects with origin check. - Client plugin (telegramClient) for type-safe integration, new docs page, and sidebar entry; includes a test for expired auth_date. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:31:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5669