LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
9.93k stars 1.4k forks source link

RPC login error #3215

Closed jtonkeys1 closed 2 years ago

jtonkeys1 commented 2 years ago

telethon.errors.rpcbaseerrors.AuthKeyError: RPCError 406: UPDATE_APP_TO_LOGIN (caused by SignInRequest)

I am getting this error, anyone know the problem? Ubuntu 20.04 fresh install & can also replicate on macOS

SpiderOnTheNet commented 2 years ago

Hi,

I got the same issue on my RPI4 with yunohost to use telegramebot with Mautrix_telegram. I tried to uninstall + update telethon, but I still got the issue when i try ton login with my telegram account...

LOG :

Traceback (most recent call last): File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 409, in handle await self._run_handler(handler, evt) File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/mautrix_telegram/commands/handler.py", line 121, in _run_handler return await handler(evt) File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 296, in __call__ return await self._handler(evt) File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/mautrix_telegram/commands/telegram/auth.py", line 155, in login_qr await qr_login.recreate() File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/telethon/tl/custom/qrlogin.py", line 27, in recreate self._resp = await self._client(self._request) File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/telethon/client/users.py", line 30, in __call__ return await self._call(self._sender, request, ordered=ordered) File "/opt/yunohost/mautrix_telegram/lib/python3.7/site-packages/telethon/client/users.py", line 79, in _call result = await future telethon.errors.rpcbaseerrors.AuthKeyError: RPCError 406: UPDATE_APP_TO_LOGIN (caused by ExportLoginTokenRequest)

Did I miss something ?

More info : python is already the newest version (2.7.16-1). Telethon version : Telethon-1.24.0

Thx

Anderson9889 commented 2 years ago

C:\Users\Anderson>pip install -U telethon --no-cache Requirement already satisfied: telethon in c:\users\anderson\appdata\local\programs\python\python39\lib\site-packages (1.24.0) Requirement already satisfied: rsa in c:\users\anderson\appdata\local\programs\python\python39\lib\site-packages (from telethon) (4.8) Requirement already satisfied: pyaes in c:\users\anderson\appdata\local\programs\python\python39\lib\site-packages (from telethon) (1.6.1) Requirement already satisfied: pyasn1>=0.1.3 in c:\users\anderson\appdata\local\programs\python\python39\lib\site-packages (from rsa->telethon) (0.4.8) WARNING: You are using pip version 21.1.3; however, version 21.3.1 is available. You should consider upgrading via the 'c:\users\anderson\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command.

continuo com o mesmo problema poderia me ajudar, pois nao consigo logar telegram

zencooler commented 2 years ago

I have the same error (406 UPDATE_APP_TO_LOGIN) in python scripts attempting to login to Telegram :( I upgraded Telethon to ver. 1.24.0 but it didn't solve the problem. Does anybody know how to finally solve that problem, please? Thx in advance for any tip.

gnadelwartz commented 2 years ago

I have the same error (406 UPDATE_APP_TO_LOGIN) in python scripts attempting to login to Telegram :( I upgraded Telethon to ver. 1.24.0 but it didn't solve the problem. Does anybody know how to finally solve that problem, please?

Please take care that your script is using the correct version. To verify add print the telethon version in your bot script right after the "import telethon" statement and run your script as usual, .e.g.

import telethon
print('Telethon Version used: '+telethon.__version__)
quit()

this should output: Telethon Version used: 1.24.0

zencooler commented 2 years ago

I have the same error (406 UPDATE_APP_TO_LOGIN) in python scripts attempting to login to Telegram :( I upgraded Telethon to ver. 1.24.0 but it didn't solve the problem. Does anybody know how to finally solve that problem, please?

Please take care that your script is using the correct version. To verify add print the telethon version in your bot script right after the "import telethon" statement and run your script as usual, .e.g.

import telethon
print('Telethon Version used: '+telethon.__version__)
quit()

this should output: Telethon Version used: 1.24.0

Thank you for your suggeston. I checked it and script uses correct version. I don't know where to find the potential issue. Maybe you can look at the error result of the script and suggest something more? Here is the errors on the screen after the script run: Pyrogram v1.2.9, Copyright (C) 2017-2021 Dan https://github.com/delivrance Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)

Traceback (most recent call last): File "C:\Users\me\Desktop\TS_SPECIAL\login.py", line 38, in app.start() File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\sync.py", line 57, in async_to_sync_wrap return loop.run_until_complete(coroutine) File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete return future.result() File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\methods\utilities\start.py", line 58, in start await self.authorize() File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\client.py", line 304, in authorize sent_code = await self.send_code(self.phone_number) File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\methods\auth\send_code.py", line 50, in send_code r = await self.send( File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\methods\advanced\send.py", line 78, in send r = await self.session.send( File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\session\session.py", line 427, in send return await self._send(data, timeout=timeout) File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\session\session.py", line 397, in _send RPCError.raise_it(result, type(data)) File "C:\Users\me\AppData\Roaming\Python\Python310\site-packages\pyrogram\errors\rpc_error.py", line 70, in raise_it raise getattr( pyrogram.errors.exceptions.not_acceptable_406.NotAcceptable: [406 Not Acceptable]: [406 UPDATE_APP_TO_LOGIN] (caused by "auth.SendCode")

UPDATE: I found that Pyrogram needs to be updated as well. So after Pyrogram upgrade from 1.2.09 to 1.2.11. Thank again for help.

MADCHEONE commented 2 years ago

I have pushed v1.24 to PyPi, which fixes login (thus avoiding UPDATE_APP_TO_LOGIN), but I have not had the time to test this version thoroughly, so please make sure to report any issues you find here on GitHub...

client.iter_participants does not return users without a username, can you fix that?

GemsChain commented 2 years ago

Thank you all. Fixed the problem and now the new sessions work fine.

Aichiken commented 2 years ago

hi lonami, I want to ask why when I log in my account gets banned, is there a solution?

Idlessz commented 2 years ago

Yes , i have this problem too

Lonami commented 2 years ago

@gsa165lq31a and @Idlessz see #824. This issue is to discuss UPDATE_APP_TO_LOGIN only.

Aichiken commented 2 years ago

@gsa165lq31a and @Idlessz see #824. This issue is to discuss UPDATE_APP_TO_LOGIN only.

Okay thankyou for the attention

tssj520 commented 2 years ago

1.24.0

thanks . is ok! 1.24.0

Lonami commented 2 years ago

v2 is still in the works, primarily, proxies and entity still needs some work, but it's getting there. People interested in knowing when more updates are made can follow https://t.me/TelethonUpdates.

aravindbhs commented 2 years ago

Any help on this please

Traceback (most recent call last): File "scraper.py", line 80, in all_participants = client.get_participants(target_group, aggressive=False) File "C:\Users\DELL.local\lib\python3.8\site-packages\telethon\sync.py", line 39, in syncified return loop.run_until_complete(coro) File "C:\Program Files\Inkscape\lib\python3.8\asyncio\base_events.py", line 616, in run_until_complete return future.result() File "C:\Users\DELL.local\lib\python3.8\site-packages\telethon\client\chats.py", line 507, in get_participants return await self.iter_participants(*args, **kwargs).collect() File "C:\Users\DELL.local\lib\python3.8\site-packages\telethon\requestiter.py", line 113, in collect async for message in self: File "C:\Users\DELL.local\lib\python3.8\site-packages\telethon\requestiter.py", line 74, in anext if await self._load_next_chunk(): File "C:\Users\DELL.local\lib\python3.8\site-packages\telethon\client\chats.py", line 224, in _load_next_chunk participants = results[i] TypeError: 'ChannelParticipants' object is not subscriptable

zloishax commented 2 years ago

help me please @Lonami

Input session name: sasaas Enter phone number or bot token: +998907809436 Is "+998907809436" correct? (y/N): y The confirmation code has been sent via Telegram app Enter confirmation code: 20395 Traceback (most recent call last):

File "erfan4lx.py", line 260, in <module>
    loop.run_until_complete(func)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 587, in run_until_complete
    return future.result()
  File "erfan4lx.py", line 234, in add_client
    async with Client(session_name, workdir=CLIENTS_DIR) as new_client:
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\client.py", line 257, in __aenter__
    return await self.start()
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\methods\utilities\start.py", line 57, in start
    await self.authorize()
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\client.py", line 327, in authorize
    signed_in = await self.sign_in(self.phone_number, sent_code.phone_code_hash, self.phone_code)
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\methods\auth\sign_in.py", line 65, in sign_in
    phone_code=phone_code
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\methods\advanced\send.py", line 81, in send
    else self.sleep_threshold)
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\session\session.py", line 441, in send
    return await self._send(data, timeout=timeout)
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\session\session.py", line 411, in _send
    RPCError.raise_it(result, type(data))
  File "C:\Users\E-MaxPCShop\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyrogram\errors\rpc_error.py", line 73, in raise_it
    is_unknown=True)
pyrogram.errors.exceptions.not_acceptable_406.NotAcceptable: [406 Not Acceptable]: [406 UPDATE_APP_TO_LOGIN] (caused by "auth.SignIn")
fornaciari commented 1 year ago

telethon.errors.rpcbaseerrors.AuthKeyError: RPCError 406: UPDATE_APP_TO_LOGIN (caused by SignInRequest)

I am getting this error, anyone know the problem? Ubuntu 20.04 fresh install & can also replicate on macOS

I solved making visible to anyone the telegram profile picture. See: https://core.telegram.org/method/contacts.getLocated

bwithai commented 1 year ago

Hello dear @ I fixed this to pip install -U Telethon

Aliymafiya005 commented 10 months ago

Hi how are you