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

unexpected authorization request #4178

Closed
3 tasks done
Vertinskyj opened this issue Aug 23, 2023 · 6 comments
Closed
3 tasks done

unexpected authorization request #4178

Vertinskyj opened this issue Aug 23, 2023 · 6 comments

Comments

@Vertinskyj
Copy link

Code that causes the issue

...
client = TelegramClient('sess', api_id, api_hash)

async def main():
# Now you can use all client methods listed below, like for example...
await client.send_message('me', 'Hello to myself!')

with client:
client.loop.run_until_complete(main())

Expected behavior

greetings

Actual behavior

Re-authorization requirement: "Please enter your phone (or bot token):".

Traceback

No response

Telethon version

1.29.3

Python version

3.9.6

Operating system (including distribution name and version)

Windows 10

Other details

The file sess.session is in the same directory as the code file.

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't an open duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
@Lonami
Copy link
Member

Lonami commented Aug 23, 2023

If the .session file is not saved correctly after login, it cannot be used without having to login again. Telegram may also be closing. Regardless, I likely cannot reproduce the issue.

@Lonami Lonami closed this as completed Aug 23, 2023
@Vertinskyj
Copy link
Author

Thanks a lot.
Unfortunately I don't know how to save correctly, nor to check correctness ;(
Program doesn't work.

@Lonami
Copy link
Member

Lonami commented Aug 23, 2023

The session should be saved on .disconnect(). This problem is likely not widespread or I'd expect more users to report this serious issue. Make sure the process can actually write to the session file.

@Vertinskyj
Copy link
Author

Vertinskyj commented Aug 24, 2023

This problem is likely not widespread or I'd expect more users to report this serious issue

I'm probably doing something wrong. But I don't understand what exactly.

The session should be saved on .disconnect().

I tried this way. The result is the same.

In addition: after each such session creation, the telegram program in the phone requires authorization when entering.

@Lonami
Copy link
Member

Lonami commented Aug 24, 2023

If other sessions are logged out, then that's #4051.

@Vertinskyj
Copy link
Author

Thank You!
The .session file works, the session has not been interrupted yet.
Belousov-Aleksandr's advice helped.

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

2 participants