Telethon: Login with another phone, code always expired

Created on 2 Jun 2017  路  15Comments  路  Source: LonamiWebs/Telethon

Hi, when I tried to login with a phone different than the one I used in the telegram API registration, the client always send me a code expired message when I provide the code for the login.

I don't know if what I'm trying to do is not supported or what. This happen using the interactive telegram client. (I'm trying to login with a different number, providing the correct login code).

I hope someone could help me.

(I am not a native speaker, sorry for my english)

Most helpful comment

Yep, if you send an auth code via Telegram it expires automatically

All 15 comments

Are you sure you're using the code sent to that phone and not to your main phone?

Yes, I'm sure.

Using my app_ID and my app_hash provided by Telegram, I put the phone number of a friend sat next to me, he received the code in his phone and I put it in the client and responded me a code expired error.

I'm supposed to be able to do this, right?

I'm supposed to be able to do this, right?

Yes, it's really strange it doesn't work with a different phone number. Do you have other phone numbers to test this with? I presume that the computer you're working with has the right time zone and such? Sorry https://core.telegram.org/api/errors doesn't give much more information about PHONE_CODE_EXPIRED.

Both people here and here mentioned it's a DC issue, but those should be handled gracefully already. Try changing the default one under session.py in the Session class? Maybe with the IP that api.telegram.org shows?

@farodrig are you sending the code via Telegram to another account before using it?

yes!! It's that??

Yep, if you send an auth code via Telegram it expires automatically

Thank you @FrayxRulez :)

Confirmed on this, btw. As soon as I had a colleague send me the login code via WhatsApp, everything worked perfectly. Huge props to @FrayxRulez .

I had completely forgotten about this issue and it was discussed again recently on another Telegram API-related group. Closing #516.

@FrayxRulez How the code expires when sending through telegram?

It's a server-side check to prevent people from "accidentally" telling a possible attacker the code.

@Lonami Even in Secret Chats?Are only the particular users message validated ?

That feeling when you don't send code to anyone, and it is always expired... =/

That feeling when you don't send code to anyone, and it is always expired... =/

Can you solve the problem?

Yep, if you send an auth code via Telegram it expires automatically

Append zero with code to obscure it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mircoianese picture mircoianese  路  3Comments

Fleyderer picture Fleyderer  路  3Comments

adv-zl picture adv-zl  路  3Comments

chri1389 picture chri1389  路  6Comments

ghost picture ghost  路  4Comments