Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

GUI example: telethon.errors.rpcerrorlist.SessionPasswordNeededError: Two-steps verification is enabled and a password is required (caused by SignInRequest)

Open Emojigit opened this issue 2 years ago • 1 comments

Checklist

  • [x] The error is in the library's code, and not in my own.
  • [x] I have searched for this issue before posting it and there isn't a duplicate.
  • [x] I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.

Code that causes the issue The gui.py in examples

Traceback

Task exception was never retrieved
future: <Task finished name='Task-18' coro=<App.sign_in() done, defined at /home/toys-webserver/gui.py:181> exception=SessionPasswordNeededError('Two-steps verification is enabled and a password is required (caused by SignInRequest)')>
Traceback (most recent call last):
  File "/home/toys-webserver/gui.py", line 200, in sign_in
    self.set_signed_in(await self.cl.sign_in(code=value))
  File "/home/toys-webserver/.local/lib/python3.9/site-packages/telethon/client/auth.py", line 368, in sign_in
    result = await self(request)
  File "/home/toys-webserver/.local/lib/python3.9/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/home/toys-webserver/.local/lib/python3.9/site-packages/telethon/client/users.py", line 84, in _call
    result = await future
telethon.errors.rpcerrorlist.SessionPasswordNeededError: Two-steps verification is enabled and a password is required (caused by SignInRequest)

Emojigit avatar Mar 26 '22 03:03 Emojigit

That's not a bug. Asking user for password wasn't implemented in gui.py, and if you would like to do it - you can create a PR.

apepenkov avatar Apr 06 '22 16:04 apepenkov

As stated, the GUI example does not implement a way for the user to input their 2FA password. I think it's fine, since it's only meant to be a small example about how a GUI could be made, not necessarily a full-blown client.

Lonami avatar Sep 20 '22 15:09 Lonami