auth.exportLoginToken

Generate a login token, for login via QR code.

The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken URL in the QR code.

Example

const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.auth.exportLoginToken({
        apiId: 2138058,
        apiHash: 'random string here',
        exceptIds: [9505834],
        }));
    console.log(result); // prints the result
})();

TL schema

tg://login?token=base64encodedtoken

Parameters

Name

Type

Description

api_id

Application identifier (see. App configuration)

api_hash

Application identifier hash (see. App configuration)

except_ids

List of already logged-in user IDs, to prevent logging in twice with the same user

Result

auth.LoginToken

Possible errors

Code

Type

Description

Can bots use this methd ?

yes

QR code login flow

Last updated