Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/mtkruto/mod.ts>Client#authorize

Cross-runtime JavaScript library for building Telegram clients
Go to Latest
method Client.prototype.authorize
import { Client } from "https://deno.land/x/mtkruto@0.1.157/mod.ts";

Calls initConnection and authorizes the client with one of the following:

  • Bot token (string)
  • Exported authorization (types.AuthExportedAuthorization)
  • User authorization handlers (AuthorizeUserParams)

if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling updates.getState.

Notes:

  1. Requires the apiId and apiHash paramters to be passed when constructing the client.
  2. Reconnects the client to the appropriate DC in case of MIGRATE_X errors.
  3. The parameters passed to the initConnection call can be configured with the last parameter of the constructor.

Parameters

optional
params: string | types.auth.ExportedAuthorization | AuthorizeUserParams