Vue3 Telegram Login
Base on vue-telegram-login, thanks @vchaptsev
Installation
Install with yarn:
Install with npm:
Usage
Import telegram-login-temp
, pass it to the components
and use in your template
Props
You can play around with options on the official widget page
Name | Description | Required | Default |
---|---|---|---|
mode | 'callback' or 'redirect' | True | null |
telegramLogin | Your telegram bot name | True | null |
@callback | Your callback function, it will be called after success if mode is 'callback' | False | true |
@loaded | Telegram script loaded callback function | False | null |
redirectUrl | Your redirect URL, user will be redirected if mode is 'redirect' | False | null |
requestAccess | 'write' if you want to get access to send messages from your bot | False | 'read' |
size | 'large', 'medium' or 'small' | False | 'large' |
userpic | Show user photo, true or false | False | true |
radius | Button corner radius (default depends on chosen size) | False | 20\14\10 |
Notes
- You need to set domain to your bot if you want to user Telagram Login (
/setdomain
command to @BotFather) - You need to verify the authentication and the integrity of the data received by comparing the received hash parameter with the hexadecimal representation of the HMAC-SHA-256 signature of the data-check-string with the SHA256 hash of the bot's token used as a secret key (source).
You can find some code samples on this page. - Don't disable third party cookies if you want to use Telegram Login as a User (thanks @robverhoef)