sign_in()

Client.sign_in()

Authorize a user in Telegram with a valid confirmation code.

Usable by Users Bots
Parameters:
  • phone_number (str) – Phone number in international format (includes the country prefix).

  • phone_code_hash (str) – Code identifier taken from the result of send_code().

  • phone_code (str) – The valid confirmation code you received (either as Telegram message or as SMS in your phone number).

Returns:

User | bool – On success, in case the authorization completed, the user is returned.

Raises:
  • BadRequest – In case the arguments are invalid.

  • SessionPasswordNeeded – In case a password is needed to sign in.

  • PhoneNumberUnoccupied – In case the phone number is not registered on Telegram.