Linux 软件免费装
Banner图

Sign in with Telegram

开发者 automattic
gmjuhasz
manzoorwanijk
更新时间 2026年6月2日 17:13
PHP版本: 8.1 及以上
WordPress版本: 7.0
版权: GPLv2 or later
版权网址: 版权信息

标签

login authentication telegram sign-in oidc

下载

0.1.4 0.1.5

详情介绍:

Sign in with Telegram lets your visitors log in with their Telegram account — no extra password to remember, no new account to create. Unlike older Telegram-login plugins that rely on a script embedded from Telegram (which modern privacy-focused browsers often block), this plugin uses Telegram's standard OpenID Connect login: a secure redirect to Telegram and back. It works reliably in every browser, including ones with strict tracker blocking turned on. Features How it compares to the legacy Login Widget Telegram's older Login Widget (used by most existing Telegram-login plugins on the directory) is not OAuth or OpenID Connect. It loads a JavaScript file from telegram.org that renders Telegram's button on your page and then hands the auth result either to a JavaScript callback or to a server URL. Either mode still needs the embedded script to render the button in the first place. That setup is increasingly fragile: Sign in with Telegram uses Telegram's newer OpenID Connect provider instead — a standard server-side redirect flow with a properly signed RS256 id_token. No third-party scripts on your pages, no shared bot-token secret with verifiers, automatic key rotation via JWKS. It behaves the same regardless of how privacy-locked-down the visitor's browser is.

安装:

  1. Install and activate the plugin.
  2. Open @BotFather in Telegram and launch its mini app from the attachment menu (the paperclip icon in the chat).
  3. Pick your bot under My bots, then open Login widget. If your bot is still on the legacy widget, click Switch to OpenID Connect Login and confirm.
  4. Register the callback URL under Redirect URIshttps://yoursite.com/wp-login.php?action=telegram_signin_callback — and add the matching site origin (https://yoursite.com) to Trusted Origins. HTTPS is required.
  5. Copy the Client ID and Client Secret that BotFather shows you and paste them into Settings → Sign in with Telegram in wp-admin.
  6. Optionally drop the Telegram Login Button block on your homepage, or add the [telegram_signin_button] shortcode anywhere you want a sign-in button.

屏幕截图:

  • Instructions show the Redirect URI and Trusted Origin for @BotFather.
  • The WordPress login form gains a Sign in with Telegram button.
  • User profiles can connect or disconnect Telegram.
  • The Users list can show Telegram-verified phone numbers.

常见问题:

Where do I get the Client ID and Client Secret?

Open @BotFather in Telegram and launch its mini app from the attachment menu. Pick your bot under My bots, go to Login widget, and if you haven't already, click Switch to OpenID Connect Login and confirm. BotFather then shows the Client ID and Client Secret and lets you register the Redirect URIs and Trusted Origins your site will use. The Client Secret is not the bot token — they're different values, and the settings page warns you if you paste the wrong one.

Do my visitors need to install anything?

No. Telegram's OpenID Connect provider works through a normal browser redirect — visitors are sent to Telegram's login page, approve the sign-in, and land back on your site. They don't need the Telegram desktop / mobile app open or any browser extension.

Will it work in browsers with strict privacy or tracker blocking?

Yes. The plugin doesn't load any third-party scripts on your pages. Sign-in happens through a server-side redirect, the same way "Sign in with Google" or other OpenID Connect integrations do. Browsers that block telegram.org's Login Widget script (Brave on default shields, Firefox ETP on Strict, Safari with Lockdown Mode, etc.) handle this flow fine.

How does this handle email addresses?

Telegram's OIDC provider doesn't supply an email claim, so the plugin creates new users without an email by default. Settings let you instead require a synthetic placeholder email (so password recovery still nominally works), or block sign-ups entirely and only allow existing WordPress users to connect their Telegram account from the profile screen.

Is my visitor's password ever sent to Telegram?

No. The plugin doesn't touch WordPress passwords. Sign-in happens entirely through Telegram's authentication system; your WordPress site receives a signed token verifying that the user is who they say they are.

Where can I find the source code?

The plugin is developed in the open at github.com/Automattic/sign-in-with-telegram. The repository contains the full TypeScript source for the React-based settings UI and the Block Editor block, the build tooling (npm scripts driving @wordpress/build), and the test suite. Issues and pull requests are welcome.

Where is the user's phone number stored?

When the phone scope is granted, Telegram returns the phone number as a claim in the signed id_token. The plugin stores that value in its own usermeta key — telegram_signin_phone. Read the verified value via Automattic\Telegram\SignIn\Phone::for_user( $user_id ), and hook the telegram_signin_phone filter to redact or normalize it. Site authors on WooCommerce can surface the verified value as the customer's billing phone by hooking woocommerce_customer_get_billing_phone.

更新日志:

0.1.5 For the full version history, see the changelog on GitHub.