-
-
Save anonymous/6516521b1fb3b464534fbc30ea3573c2 to your computer and use it in GitHub Desktop.
<?php | |
define('BOT_USERNAME', 'XXXXXXXXXX'); // place username of your bot here | |
function getTelegramUserData() { | |
if (isset($_COOKIE['tg_user'])) { | |
$auth_data_json = urldecode($_COOKIE['tg_user']); | |
$auth_data = json_decode($auth_data_json, true); | |
return $auth_data; | |
} | |
return false; | |
} | |
if ($_GET['logout']) { | |
setcookie('tg_user', ''); | |
header('Location: login_example.php'); | |
} | |
$tg_user = getTelegramUserData(); | |
if ($tg_user !== false) { | |
$first_name = htmlspecialchars($tg_user['first_name']); | |
$last_name = htmlspecialchars($tg_user['last_name']); | |
if (isset($tg_user['username'])) { | |
$username = htmlspecialchars($tg_user['username']); | |
$html = "<h1>Hello, <a href=\"https://t.me/{$username}\">{$first_name} {$last_name}</a>!</h1>"; | |
} else { | |
$html = "<h1>Hello, {$first_name} {$last_name}!</h1>"; | |
} | |
if (isset($tg_user['photo_url'])) { | |
$photo_url = htmlspecialchars($tg_user['photo_url']); | |
$html .= "<img src=\"{$photo_url}\">"; | |
} | |
$html .= "<p><a href=\"?logout=1\">Log out</a></p>"; | |
} else { | |
$bot_username = BOT_USERNAME; | |
$html = <<<HTML | |
<h1>Hello, anonymous!</h1> | |
<script async src="https://telegram.org/js/telegram-widget.js?2" data-telegram-login="{$bot_username}" data-size="large" data-auth-url="check_authorization.php"></script> | |
HTML; | |
} | |
echo <<<HTML | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Login Widget Example</title> | |
</head> | |
<body><center>{$html}</center></body> | |
</html> | |
HTML; | |
?> |
Telegram login widget is not working on my web site and i don't understand why. It's just stuck when Telegram must send confirmation message. If i already logged in on telegram.org its working as needed, but i can't receive confirmation via my web site. Enabling cross site cookies does not resolve the problem
@rekkisomo @Comrade19632 if you find any solution, please ping
Telegram login widget is not working on my web site and i don't understand why. It's just stuck when Telegram must send confirmation message. If i already logged in on telegram.org its working as needed, but i can't receive confirmation via my web site. Enabling cross site cookies does not resolve the problem
@rekkisomo @Comrade19632 if you find any solution, please ping
@rekkisomo @Comrade19632 + anyone with same problem, here is the solution: https://stackoverflow.com/a/74193012/15090151
quote: "I fixed it by changing the domain. I don’t know why, but the telegram login widget does not want to work with the tgmm.xyz domain."
xyz ltd or maybe some other are rejected by Telegram for some reason.
I couldn't receive code through number.why?
Plz help me
I couldn't receive code through number.why? Plz help me
What is domain zone of your app, .xyz?
How to use profile picture?
mwjira@gmail.com 0944747844
34832
Can I receive code just by this email-Abukimuhamad7@gmail.com cause my number 0936248150 is deactivated due to my sim is lost
Can I receive code just by this email-Abukimuhamad7@gmail.com cause my number 0936248150 is deactivated due to my sim is lost
i got a error
Bot domain invalid
Check if you are using
https
i also getting the same error,
i'm using https
@meysamsaz
@mrsaz7
+----+----+----+----...----+
|tlen|FFFF|abcd| padding |
+----+----+----+----...----+
Hello, I want to integrate my mobile game into Telegram. Does anyone know how I can do it?
Salom