'aiogram Why code has expired for different users with the same api_i and api_hash?

I working on python telegram bot that allow login telegram client using registered user and then do some actions using user credentials ... ... But I got the following error:

ERROR: The confirmation code has expired (caused by SignInRequest)

I use the following libraries aiogram and telethon. The error above is provided by telethon

Looks like telethon cannot use the same api_id and api_hash for different users ...

But if it is a case then I make bot useless, because user should now about api_id and api_hash and I cannot login telegram client by user credentials ... It is very strange ...

Looks like it happens not for all accounts ... some accounts login successful ...

Have anybody faced with the same error ?



Solution 1:[1]

This error is usually encountered when you send the auth code to someone's dm in Telegram. This is done for security, so that people don't send their auth codes to scammers. If this is intentional, you can modify the auth code before sending it. E.g. use an underscore: "123_45"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MMM