Telegram login widget

Embed a telegram login button in your svelte application.

Demo

Code

Svelte
1<script>
2  import { Login } from 'sveltegram';
3</script>
4
5<Login
6  username="ComputlyBot"
7  requestAccess={true}
8  onauth={(data) => { console.log("User ID:", data.id); }}
9/>

API

Please refer to Telegram documentation for more details.

username required
string
—
Your bot username
authType
string
callback
How to authenticate users? Choices are "callback" or "redirect"
redirectURL
string
—
In case you chose redirect as an authentication method, you must set this property
requestAccess
boolean
false
Whether you want to send messages to the user in the future.
size
string
medium
Login button size. choices are [small, medium,large]
buttonRadius
number
10
Login button radius (in pixels)
onauth required
Function
—
Callback function responsible for handling successful authentication