Skip to content

Nuxt Telegram AuthTelegram login for Nuxt

Telegram's login widget and OAuth redirect in your Nuxt app, with the session checked and sealed on the server.

Nuxt Telegram Auth

What it does ​

nuxt-telegram-auth adds "Log in with Telegram" to a Nuxt app. People sign in with the Telegram account they already have, so there are no passwords to store and no email to confirm. The module handles the whole flow: it shows Telegram's login button or sends the browser to Telegram, checks the answer on your server and keeps the user logged in with a cookie.

It suits apps whose users are already on Telegram, such as a dashboard for a bot, a community site or a tool for a group chat, and any Nuxt project that wants a login without running its own user database.

How a login works ​

  1. The visitor clicks <TelegramLoginButton> and confirms in Telegram's popup, or follows a link to /auth/telegram for the redirect flow.
  2. Telegram returns an id_token. Your server checks it against Telegram's public keys and against the one-time values the module created for that login: a nonce for both flows, plus state and PKCE for the redirect.
  3. The module runs your telegram-auth:login hook, if you registered one, and writes the session into a sealed, HttpOnly cookie.
  4. useTelegramSession() in your components and requireTelegramSession(event) in your server routes read that session.

The browser never decides who is logged in. Only data that passed the server checks ends up in the session.

Requirements ​

  • Nuxt 4.6 or newer.
  • Node.js 22.22.3 or a later 22.x, 24.15.0 or a later 24.x, or 26 and newer.
  • A Telegram bot with Telegram Login turned on in BotFather, and your site listed in its Allowed URLs.
  • A session secret of at least 32 characters in production.

Start here ​