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

send_code_request not working #4047

Closed
Dantekk opened this issue Feb 23, 2023 · 2 comments
Closed

send_code_request not working #4047

Dantekk opened this issue Feb 23, 2023 · 2 comments

Comments

@Dantekk
Copy link

Dantekk commented Feb 23, 2023

This is my code :

from telethon.sync import TelegramClient

api_id = .....
api_hash = ......

client = TelegramClient("session_name", api_id, api_hash)

async def main():
    await client.connect()
    phone_number = "+34xxxxxxxxx"
    client.send_code_request(phone_number, force_sms=True)
    verification_code = input("Add code : ")
    client.sign_up(verification_code, first_name="joe", last_name="smith")

    await client.disconnect()


client.loop.run_until_complete(main())

I got this errore message in send_code_request() function :

telethon.errors.rpcerrorlist.SendCodeUnavailableError: Returned when all available options for this type of number were already used (e.g. flash-call, then SMS, then this error might be returned to trigger a second resend) (caused by ResendCodeRequest)

I don't know what is the problem... I have tried a lot of different number but I always got the same error, meanwhile sign_in() function working very well.

@Lonami
Copy link
Member

Lonami commented Feb 24, 2023

Telegram sent this message to those with an API ID and hash:

Telegram API Update. Hello —,. Thank you for contributing to the open Telegram ecosystem by developing your app, —.

Please note that due to recent updates to Telegram's handling of SMS and the integration of new SMS providers like Firebase, we are changing the way login codes are handled in third-party apps based on the Telegram API.

Starting on 18.02.2023, users logging into third-party apps will only be able to receive login codes via Telegram. It will no longer be possible to request an SMS to log into your app – just like when logging into Telegram's own desktop and web clients.

Exactly like with the Telegram Desktop and Web apps, if a user doesn’t have a Telegram account yet, they will need to create one first using an official mobile Telegram app.

We kindly ask you to update your app’s login and signup interfaces to reflect these changes before they go live on 18.02.2023 at 13:00 UTC.

This change will not significantly affect users since, according to our research, the vast majority of third-party app users also use official Telegram apps. In the coming months, we expect to offer new tools for third-party developers that will help streamline the login process.

In short, SMS login or sign up will no longer work in third-party libraries, including Telethon. This cannot be "fixed".

@Lonami Lonami closed this as completed Feb 24, 2023
@Lonami Lonami pinned this issue Feb 24, 2023
@Lonami
Copy link
Member

Lonami commented Feb 24, 2023

Also duplicate of #3835, which was even pinned.

@Lonami Lonami unpinned this issue Feb 24, 2023
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