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

Signed out of my account on all my devices #4051

Closed
3 tasks done
Mostalk opened this issue Feb 27, 2023 · 24 comments
Closed
3 tasks done

Signed out of my account on all my devices #4051

Mostalk opened this issue Feb 27, 2023 · 24 comments

Comments

@Mostalk
Copy link

Mostalk commented Feb 27, 2023

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 a duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.

Code that causes the issue

from telethon.sync import TelegramClient
with TelegramClient("main", 123456, "token") as client:
    for message in client.iter_messages("https://t.me/channel"):
        if message.text:
            print(message.text")

I ran this code three times and each time it logged out all my devices from my phone, computer and telethon session. As a result, I was given a ban for 24 HOURS in any attempt to enter my telegram account. Thanks a lot. I will be without work and communication for a day....

@Lonami
Copy link
Member

Lonami commented Feb 27, 2023

Thanks a lot

Thinking Telethon is intentionally telling Telegram to ban its users would be silly. The library wouldn't be as used nearly as much if that was the case.

You don't have to take my word for it though, if this is something you particularly care about, please by all means audit the library. To the best of my knowledge, Telethon doesn't do anything which would clearly direct to a ban. But maybe I'm wrong.

Regardless, this is even explained in the FAQ - My account was deleted/limited when using the library (permalink). So it's not like I'm trying to hide it.

Anyway, I'll be closing this as it's not really something actionable from my side (unless your audit brings up results). Telethon is unfortunately abused by many spammers, so it is very likely Telegram has learned to pick up on patterns to detect this library, and be more willing to hand out bans. See #824 for more resources.

@Lonami Lonami closed this as completed Feb 27, 2023
@Belousov-Aleksandr
Copy link

When i use any telethon-metod, this leads to the same results. Disconnect from all device. After launching the TelegramClient, only the first method of the code is triggered, then the account is disconnected...

@Mostalk
Copy link
Author

Mostalk commented Mar 12, 2023

When i use any telethon-metod, this leads to the same results. Disconnect from all device. After launching the TelegramClient, only the first method of the code is triggered, then the account is disconnected...

I tried with VPN and different accounts - same, any use of telethon disconnect from all device. I had to temporarily switch to another library, I hope this problem will be fixed

@Belousov-Aleksandr
Copy link

When i use any telethon-metod, this leads to the same results. Disconnect from all device. After launching the TelegramClient, only the first method of the code is triggered, then the account is disconnected...

I tried with VPN and different accounts - same, any use of telethon disconnect from all device. I had to temporarily switch to another library, I hope this problem will be fixed

pyrogram...it works without failures and problems.

@Lonami
Copy link
Member

Lonami commented Mar 12, 2023

The most likely unfortunate reason is that Telethon has been abused by many spammers in the past, and so Telegram has learnt some way to detect Telethon, and is more likely to ban or restrict accounts. I really don't think there's anything that can be done. Even if it was somehow "fixed", the library would be abused yet again and lead to the same problems.

@Belousov-Aleksandr
Copy link

May be need change "user-agent" string with name Telethon-library? ))

@Lonami
Copy link
Member

Lonami commented Mar 12, 2023

You can try to configure the parameters used to initialize the connection in the TelegramClient constructor as documented. However there isn't really much point in me to try and "fix" that for everyone. Others will abuse it, and it will be caught again.

@Lonami Lonami pinned this issue Mar 13, 2023
@viatcheslavmogilevsky
Copy link

The same happened yesterday, so I've subscribed to this issue.

I'm trying to use Telethon to automate backups my own scheduled messages - there is no "Export chat history" button for scheduled messages yet, so I ended up using my own script on top of Telethon.

Life would be more easier if Telegram devs add "claims" to App configuration, besides api_id, app_hash and titles, like: "messages:read-only:me" - which will indicate that app is only supposed to read owner's messages, no more - so definitely it is not for spam.

Thanks for the library, anyway.

@Lonami
Copy link
Member

Lonami commented Mar 22, 2023

I appreciate the kind words and sympathize with those affected. It really sucks when your library essentially can't be used because Telegram decided so. With that said, I'd like to point out, this problem is not exclusive to Telethon, as demonstrated by pyrogram/pyrogram#1236.

@Belousov-Aleksandr
Copy link

However, a solution to this problem has been found. Who is interested - ask me. Solution absolutely not obvious...

@Lonami
Copy link
Member

Lonami commented Mar 29, 2023

This is a good time to remind everyone experiencing this issue to be wary of scams and people trying to sell solutions. The decision is always on Telegram. I'm sure people will find a way to delay this error. But do think twice before buying solutions.

@NickTxD
Copy link

NickTxD commented Mar 30, 2023

However, a solution to this problem has been found. Who is interested - ask me. Solution absolutely not obvious...

So what's the solution?

@Belousov-Aleksandr
Copy link

Belousov-Aleksandr commented Mar 31, 2023

However, a solution to this problem has been found. Who is interested - ask me. Solution absolutely not obvious...

So what's the solution?

You need to run the client with the following parameters - client = TelegramClient('my_session', api_id, api_hash, system_version="4.16.30-vxCUSTOM")
Just need add a parameter 'system_version' as is, but 'CUSTOM' can be changed to any other string.
Don't ask me why it works ) I don't know ))

Let the author of the Telethon-library tell us why it works...

@Lonami Lonami mentioned this issue Apr 1, 2023
@a-bashtannik
Copy link

As mentioned @Belousov-Aleksandr , the problem is setting up your client headers, but 4.16.30-vxCUSTOM is not a magic word, it's just a constant used on some embedded device or other platform, I guess.

Solution:

Log in Telegram official client on your desktop, enable debug mode, collect some logs (write a message), and check the following parameters:

            api_id: [INT],
            device_model: [STRING],
            system_version:  [STRING],
            app_version: [STRING],
            system_lang_code: [STRING],
            lang_pack: [STRING],
            lang_code: [STRING],

Make sure you have the same settings when instantiating TelegramClient class.

@MrDarkness117
Copy link

MrDarkness117 commented Apr 13, 2023

Woah, I've come to face the same issue just yesterday. It didn't happen to be in my older Telethon version that I installed like, maybe, this January. Then my server got hacked (who the hell would need to do that anyway? Nothing much of value) and I had to reinstall everything.

Once I did and tried to run my app, it backfired and I was logged out of all of my devices.

@a-bashtannik how exactly do you enable debug mode and collect all the info?

@NickTxD
Copy link

NickTxD commented Apr 23, 2023

@MrDarkness117

Type 'debugmode' in the settings page of Telegram desktop and confirm it.
Logs will be saved C:\Users\USER_NAME\AppData\Roaming\Telegram Desktop

@0dminnimda
Copy link

The solutions seem more like a hack. Were there any progress to present this from the devs? This behavior defenitely should not be happening ...

@a-poluyanov
Copy link

I faced the same problem, is it a hack on the part of this application or not?

@v2boardbot
Copy link

debugmode

I didn't find debugmode in the settings,Where can I find him

@dimania
Copy link

dimania commented Jan 24, 2024

Hi All! If use parameter system_version (by example: system_version="1.01") all work fine. As wrote @Belousov-Aleksandr.

@wind-hx
Copy link

wind-hx commented Mar 19, 2024

Hi All! If use parameter system_version (by example: system_version="1.01") all work fine. As wrote @Belousov-Aleksandr.

Can you provide api_id, api_hash, app_version, and other configuration information?

@Lonami
Copy link
Member

Lonami commented Mar 19, 2024

API ID and hash are private. You're expected to use your own, not someone else's, at the risk of being banned.

@wind-hx
Copy link

wind-hx commented Mar 19, 2024

However, a solution to this problem has been found. Who is interested - ask me. Solution absolutely not obvious...

So what's the solution?

You need to run the client with the following parameters - client = TelegramClient('my_session', api_id, api_hash, system_version="4.16.30-vxCUSTOM") Just need add a parameter 'system_version' as is, but 'CUSTOM' can be changed to any other string. Don't ask me why it works ) I don't know ))

Let the author of the Telethon-library tell us why it works...

        device_model: [Samsung Galaxy S24 Ultra, running Android 14],
        system_version:  [4.16.30-vxCUSTOM],
        app_version: [1.0.1],
        system_lang_code: [en],
        lang_pack: [en],
        lang_code: [en],

This is my device information,AUTH_KEY_UNREGISTERED error still occurs,How can I adjust to avoid the AUTH_KEY_UNREGISTERED error?

@ImMALWARE
Copy link

However, a solution to this problem has been found. Who is interested - ask me. Solution absolutely not obvious...

So what's the solution?

You need to run the client with the following parameters - client = TelegramClient('my_session', api_id, api_hash, system_version="4.16.30-vxCUSTOM") Just need add a parameter 'system_version' as is, but 'CUSTOM' can be changed to any other string. Don't ask me why it works ) I don't know ))

Let the author of the Telethon-library tell us why it works...

That does not work. Telegram will still log you out.

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