Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC login error #3215

Closed
jtonkeys1 opened this issue Dec 1, 2021 · 68 comments
Closed

RPC login error #3215

jtonkeys1 opened this issue Dec 1, 2021 · 68 comments

Comments

@jtonkeys1
Copy link

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

@raicg

This comment has been minimized.

@huisu773
Copy link

huisu773 commented Dec 1, 2021

I have a similar problem on Windows 11 and I can also replicate it on Ubuntu 20.04.

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

It only appears when I try to login with phone number. But there was no problem yesterday.

@devRawnie
Copy link

devRawnie commented Dec 1, 2021

telethon.errors.rpcbaseerrors.AuthKeyError: RPCError 406: UPDATE_APP_TO_LOGIN (caused by SendCodeRequest)
Here is the full traceback, on calling client.start()

File "/home/ec2-user/forwardgram/venv/lib64/python3.7/site-packages/telethon/client/auth.py", line 133, in start
    else self.loop.run_until_complete(coro)
  File "/usr/lib64/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/home/ec2-user/forwardgram/venv/lib64/python3.7/site-packages/telethon/client/auth.py", line 189, in _start
    await self.send_code_request(phone, force_sms=force_sms)
  File "/home/ec2-user/forwardgram/venv/lib64/python3.7/site-packages/telethon/client/auth.py", line 515, in send_code_request
    phone, self.api_id, self.api_hash, types.CodeSettings()))
  File "/home/ec2-user/forwardgram/venv/lib64/python3.7/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/home/ec2-user/forwardgram/venv/lib64/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 SendCodeRequest)

Facing the same issue on AWS EC2, based on CentOS. This was working fine few hours ago. I got this error, when I opened up a new session, while I had 3 existing sessions already.

@atrdev-rgb

This comment has been minimized.

@yaobiao131

This comment has been minimized.

@tedmosbious

This comment has been minimized.

@Lonami
Copy link
Member

Lonami commented Dec 1, 2021

The library must be updated. I will try to find time to do so as soon as possible (at least so that login works…). Previous sessions should be okay for a bit longer. Thank you all for your patience.

If you have the same issue, please react with a thumbs-up (👍) emoji to the original post rather than posting another comment to avoid notifying everyone. I will post updates in this thread.

Telegram has started enforcing the use of 64-bit identifiers for users and chats, and the current stable version of the library does not support them yet. If you try to login, you may see UPDATE_APP_TO_LOGIN error.

I will try to find time to update the library as soon as possible. Although the first version supporting this new layer may not be as well-tested as I would've liked (because I haven't had much time to devote to open source lately). Thank you for your patience.

If you want to stay updated, please subscribe to this GitHub thread.

old fix, read further comments for current solution

If someone desperatily needs this fix, please uninstall telethon and install either:

(You may also use a virtual environment.)

@Lonami
Copy link
Member

Lonami commented Dec 1, 2021

Here are some additional questions people have asked, and the answers:

How does Telegram know if Telethon supports 64-bit IDs or not?

Telegram has a concept known as "layers", allowing old apps to remain working on old layers, and new apps using new layers to enjoy new changes. The current stable version of Telethon has an old layer. Telegram has "split" the layers and left old ones no longer working probably because recent changes have made it very hard to remain backward-compatible (changing user identifiers from 32 to 64 bits is a pretty big change).

After the library updates will the previous session be compatible/usable or will they become invalid?

Previous session files should remain valid (Telethon will still understand them), but it's not possible to know if Telegram will revoke them for other reasons (although it shouldn't).

Does this issue affect bots too?

Yes, bots also need to "login" to work with the API, using a bot token, so they also can get the error.

If I have userbot running, until I restart, it should (probably) be okay?

Existing sessions (and sessions currently in use) should be fine.

Will Telethon add block ads?

The library will not block sponsored messages. Doing so is against Telegram's Terms of Service. If you develop an application using Telethon, you must comply with them, or risk getting your account banned in some way.

If your app allows accessing content from Telegram channels, you must include support for official sponsored messages in Telegram channels and may not interefere with this functionality.

When will a fix be published?

I will try to do this as soon as possible, but because the release will be rushed, bugs may be present. If this is the case, please be sure to report them (or vote if they already exist). For a temporary workaround, please refer to #3215 (comment).

@Ghost-147
Copy link

can this be fixed today please?

@LoicRcp
Copy link

LoicRcp commented Dec 1, 2021

Hi

Will we have to modify the codes of all our scripts using Telethon?

Thanks !

@Ghost-147
Copy link

Hi

Will we have to modify the codes of all our scripts using Telethon?

Thanks !

how please?

@gnadelwartz
Copy link

gnadelwartz commented Dec 1, 2021

Hi

Will we have to modify the codes of all our scripts using Telethon?

Thanks !

no, telethon will take care of compatibility. only if you made stupid assumptions like userd-id will never bigger than 2,147,483,647 you may have to change your script.

@truexackep

This comment has been minimized.

@Lonami
Copy link
Member

Lonami commented Dec 1, 2021

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.

It contains two more hot-fixes (and the "latest" 133 layer, to prevent receiving broken constructors), but not the latest layer, currently 135, to avoid breaking more things than necessary). Note that if you uninstalled telethon to install the workarounds, you will now need to uninstall the workarounds and install telethon again.

Thank you for your patience and understanding.

Please be aware that this new version uses 64 bit identifier for users, chats, and more. You may need to update your code to handle this correctly.

@joaopedrolourencoaffonso

1 - Thanks for the work @Lonami! It really helps a lot!
2 - When you release the final new version, could you alert here? So we all update immediately.
3 - About security, there was any meaningfull change?

@MADCHEONE

This comment has been minimized.

True-Angle added a commit to True-Angle/tg-chat-rejoin that referenced this issue Dec 1, 2021
@oliversssss

This comment has been minimized.

@Fuze-nl
Copy link

Fuze-nl commented Dec 2, 2021

Sadly does not work for me

@Lonami
Copy link
Member

Lonami commented Dec 2, 2021

@joaopedrolourencoaffonso yes, I can notify about future versions here (if I remember). Regarding security, I'm not sure what you're asking. There have been no security issues that I know of in the previous or current version. You can ask me privately about this if you know something.

@BramGamingNL please make sure you've successfully installed the latest version (verify that print(telethon.__version__) after importing is indeed 1.24).

@netquik

This comment has been minimized.

@Fuze-nl

This comment has been minimized.

@Lonami

This comment has been minimized.

@Fuze-nl

This comment has been minimized.

@fernvenue
Copy link

I just solved this issue by: python3 -m pip install --upgrade telethon

@SpiderOnTheNet
Copy link

SpiderOnTheNet commented Dec 6, 2021

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
Copy link

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
Copy link

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
Copy link

gnadelwartz commented Dec 6, 2021

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

This comment has been minimized.

@MADCHEONE

This comment has been minimized.

@GemsChain
Copy link

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

@Aichiken

This comment has been minimized.

@Idlessz

This comment has been minimized.

@Lonami

This comment has been minimized.

@Aichiken

This comment has been minimized.

Herklos added a commit to Drakkar-Software/OctoBot-Services that referenced this issue Jan 2, 2022
Herklos added a commit to Drakkar-Software/OctoBot-Services that referenced this issue Jan 2, 2022
@tssj520

This comment has been minimized.

@Lonami Lonami closed this as completed in ed70991 Jan 24, 2022
@Lonami
Copy link
Member

Lonami commented Jan 24, 2022

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.

@Lonami Lonami unpinned this issue Jan 24, 2022
@aravindbhs
Copy link

aravindbhs commented Apr 17, 2022

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
Copy link

zloishax commented Jun 11, 2022

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
Copy link

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
Copy link

bwithai commented Sep 26, 2023

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

@Aliymafiya005
Copy link

Hi how are you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests