14.0.0-e • Published 2 years ago

ngx-telegram-widget v14.0.0-e

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

NgxTelegramWidget

Compatible with Angular 14.0.0. This component allows you to implement the Telegram Login Widget without messing up with your code by dynamically inserting scripts.

Installation

NPM

npm install ngx-telegram-widget

Usage

Import it in a module:

import { NgxTelegramWidgetModule }  from 'ngx-telegram-widget';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    NgxTelegramWidgetModule
  ],

Use the component like this:

<ngx-telegram-widget
  [botName]="'SampleBot'"
  [buttonSize]="'large'"
  [showUserPhoto]="true"
  [redirectURL]="'login-with-telegram'">
</ngx-telegram-widget>

API

Inputs

InputTypeDefaultRequiredDescription
botNamestring"SampleBot"yesYour Telegram BOT's name
buttonSizestring"large"noButton size (possible values: large, medium, small)
showUserPhotobooleanfalsenoChoose whether to show the user profile picture near the button or not
useCustomCornersbooleanfalsenoChoose whether to use custom round corners or not
cornerRadiusnumber20noCorner radius: applies only if useCustomCorners is true
requestMessageAccessbooleanfalsenoIf true, it allows your Telegram BOT to send messages to the user (if the user allows you to)
redirectURLstring''yesURL to redirect the user to, after a successful auth

Local usage

Use /setdomain on @BotFather to set a custom domain (example: telegram-login.local)

Register in your hosts file a new DNS entry for telegram-login.local, pointing to 127.0.0.1.

Start ng serve with the following parameters: --host telegram-login.local --port 80. You must start the server on port 80 or 443 for the login button to work, due to Telegram Content Security Policies.

14.0.0-e

2 years ago

14.0.0-d

2 years ago

14.0.0-c

2 years ago

14.0.0-b

2 years ago

14.0.0-a

2 years ago

14.0.0

2 years ago