File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ Social backends
169169 strava
170170 stripe
171171 taobao
172+ telegram
172173 thisismyjam
173174 trello
174175 tripit
Original file line number Diff line number Diff line change 1+ Telegram
2+ ========
3+
4+ Telegram uses a widget-based authentication method for login.
5+
6+ - Create a bot using `BotFather `_ on Telegram to get a bot token.
7+
8+ - Add the Telegram backend to ``AUTHENTICATION_BACKENDS ``::
9+
10+ AUTHENTICATION_BACKENDS = (
11+ ...
12+ 'social_core.backends.telegram.TelegramAuth',
13+ ...
14+ )
15+
16+ - Fill the ``Bot Token `` value in the settings::
17+
18+ SOCIAL_AUTH_TELEGRAM_BOT_TOKEN = ''
19+
20+ - Add the Telegram Login Widget to your login page. The widget should be configured
21+ to send authentication data to your callback URL, which should be something like
22+ ``http://example.com/complete/telegram/ `` replacing ``example.com `` with your domain.
23+
24+ - The Telegram Login Widget can be added using the following HTML::
25+
26+ <script async src="https://telegram.org/js/telegram-widget.js?22"
27+ data-telegram-login="YOUR_BOT_USERNAME"
28+ data-size="large"
29+ data-auth-url="http://example.com/complete/telegram/"
30+ data-request-access="write"></script>
31+
32+ Replace ``YOUR_BOT_USERNAME`` with your bot's username (without the @ symbol)
33+ and update the ``data-auth-url`` to match your domain.
34+
35+ - The authentication process verifies the data integrity using HMAC-SHA256 with
36+ the bot token. Authentication data is considered valid for 24 hours from the
37+ ``auth_date `` timestamp.
38+
39+ - The backend extracts the following user information:
40+ - User ID (required)
41+ - Username
42+ - First name
43+ - Last name
44+ - Photo URL (if available)
45+
46+ .. _BotFather : https://t.me/botfather
You can’t perform that action at this time.
0 commit comments