node-tg-login
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

node-telegram-login

npm install node-tg-login

Simply use the check method

import { TelegramLogin } from 'node-tg-login'
const TelegramAuth = new TelegramLogin('<BOT_TOKEN>');

const verify = (data: TelegramLoginPayload) => 
  console.log(
    TelegramAuth.checkLoginData(data) ?
    `Payload is safe! We can trust ${data.first_name}`,
    'Uhm. Payload is not secure'
  );

Or as an express.js middleware like this:

import { TelegramLogin } from 'node-tg-login'
const TelegramAuth = new TelegramLogin('<BOT_TOKEN>');

app.get('/login/telegram', TelegramAuth.defaultMiddleware(), (req, res) => {
  console.log(res.locals.telegram_user)
});

Package Sidebar

Install

npm i node-tg-login

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

8.37 kB

Total Files

9

Last publish

Collaborators

  • yamatende