paul-nameless / tg

terminal telegram client
The Unlicense
943 stars 75 forks source link

RuntimeError: Telegram error: {'@type': 'error', 'code': 406, 'message': 'UPDATE_APP_TO_LOGIN', '@extra': {'request_id': 'updateAuthorizationState'}} #284

Open strongpapazola opened 2 years ago

strongpapazola commented 2 years ago

Enter your phone number in international format (including country code)
phone> +1203123123
find: ‘/root/.cache/tg/files’: No such file or directory
Enter code:12296
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/app/tg/__main__.py", line 78, in <module>
    main()
  File "/app/tg/__main__.py", line 69, in main
    tg.login()
  File "/usr/local/lib/python3.9/site-packages/telegram/client.py", line 574, in login
    self.authorization_state = self._wait_authorization_result(result)
  File "/usr/local/lib/python3.9/site-packages/telegram/client.py", line 504, in _wait_authorization_result
    result.wait(raise_exc=True)
  File "/usr/local/lib/python3.9/site-packages/telegram/utils.py", line 45, in wait
    raise RuntimeError(f'Telegram error: {self.error_info}')
RuntimeError: Telegram error: {'@type': 'error', 'code': 406, 'message': 'UPDATE_APP_TO_LOGIN', '@extra': {'request_id': 'updateAuthorizationState'}}
root@bot5:~#```
omar-polo commented 2 years ago

Same here. I've also tried to use my own codes in the config file as:

API_ID = 'XXXXXX'
API_HASH = '....'

to no avail.

P.S.: @strongpapazola althought it's not the cause of the issue, regarding the find: ‘/root/.cache/tg/files’, I wouldn't run tg (or any other IM) as root.

omar-polo commented 2 years ago

Ah, downgrading tdlib from 1.8.6 to 1.8.5 fixed the issue for me.

heitumo commented 1 year ago

tdlib

how exactly did you do that ? are you running docker as doc? as docker run -it --rm ghcr.io/paul-nameless/tg ?

omar-polo commented 1 year ago

@heitumo nope. I was about to update the OpenBSD tdlib package (currently at 1.8.4) when I saw that 1.8.6 broke td. Haven't tried with newer versions yet.

heitumo commented 1 year ago

@omar-polo Are you able to run tg and log in ?

omar-polo commented 1 year ago

@heitumo yes, with tg 0.19 and tdlib 1.8.4 i can login and it works.

% pkg_info | egrep '^(tg|tdlib|py3-telegram)-'
py3-telegram-0.15.0p0 Python wrapper for Telegram tdlib
tdlib-1.8.4p0       cross-platform library for building Telegram clients
tg-0.19.0p1         ncurses Telegram client

i got the idea that maybe the newer versions of tdlib needed some tweaks here since some some users had a similar issue with telega too: https://github.com/zevlg/telega.el/issues/374

note that you probably need to downgrade https://github.com/alexander-akhmetov/python-telegram to 0.15 too.

diego-rapoport commented 1 year ago

Same here. I've also tried to use my own codes in the config file as:

API_ID = 'XXXXXX'
API_HASH = '....'

to no avail.

P.S.: @strongpapazola althought it's not the cause of the issue, regarding the find: ‘/root/.cache/tg/files’, I wouldn't run tg (or any other IM) as root.

Hi!! I use Arch and some things differs from you, like tdlib versions and I couldn't downgrade python-telegram for some reason I still don't know. Should I set API_ID and API_HASH for this or take another set of actions?