Login ButtonsBOT-ONLY
Bot Walkthrough 15 of 18
Bots can let users sign in to a website with their Telegram account.
Sending a Login Button
Link the website’s domain to the bot through @BotFather, then send a loginUrl button with an HTTPS URL.
client.command("login", async (ctx) => {
await ctx.reply("Sign in to continue:", {
replyMarkup: {
type: "inlineKeyboard",
inlineKeyboard: [
[
{
type: "loginUrl",
text: "Sign in",
loginUrl: {
url: "https://example.com/login",
},
},
],
],
},
});
});
Telegram adds signed authentication data to the URL. Verify it on the server before signing the user in.