MadelineProtoDocs/old_docs/API_docs_v40/methods/auth.exportLoginToken.md
2020-10-01 20:29:43 +02:00

1.9 KiB

title description image redirect_from
auth.exportLoginToken Generate a login token, for [login via QR code](https://core.telegram.org/api/qr-login). https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png /API_docs/methods/auth_exportLoginToken.html

Method: auth.exportLoginToken

Back to methods index

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.

For more info, see login via QR code.

Parameters:

Name Type Description Required
api_id int Application identifier (see. App configuration) Yes
api_hash string Application identifier hash (see. App configuration) Yes
except_ids Array of int List of already logged-in user IDs, to prevent logging in twice with the same user Yes

Return type: auth.LoginToken

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$auth.LoginToken = $MadelineProto->auth->exportLoginToken(['api_id' => int, 'api_hash' => 'string', 'except_ids' => [int, int], ]);

Or, if you're into Lua:

auth.LoginToken = auth.exportLoginToken({api_id=int, api_hash='string', except_ids={int}, })