I'm trying to authorize in telethon via QR. In the docs of telegram I found the method exportLoginToken, which allows you to create a token for qr code. If I understand it correctly, the desktop telegram client uses this mechanics. You scan the qr from an authorized device and the session opens on the pc.
Telethon also has it. Example from the documentation:
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.auth.ExportLoginTokenRequest(
api_id=42,
api_hash='some string here',
except_ids=[42]
))
print(result.stringify())
If we don't have an active session, it will create one when we enter as telethon. For this we need a number and a code. Or an active session and a connected client The telethon docs say: Note that you must be connected before invoking this, as with any other request.
So in order to create an authorization token on the new device I must already be authorized? How do I get a token for the qr code on a device that has no active sessions?