Td Api Update Authorization State - OTR/Kotlin-Telegram-Client GitHub Wiki

Class TdApi.UpdateAuthorizationState

Represents an incoming update about the authorization state of the user.

Property

  • authorizationState: TdApi.AuthorizationState - New authorization state. May be null.

TdApi.AuthorizationState - is an abstract base class which has the following subclasses:

Possible values of authorizationState

NOTE: that TD Light Java unlike TD Lib has no Wait Encryption Key State. TdApi.AuthorizationStateWaitEncryptionKey - DEPRECATED The user is currently waiting for the first message to be delivered to the secret chat.

Core Telegram ref, TDLib X ref

Closed

TdApi.AuthorizationStateClosed - The user is no longer authorized. TDLib client is in its final state. All databases are closed and all resources are released. No other updates will be received after this. All queries will be responded to with error code 500. To continue working, one must create a new instance of the TDLib client.

Closing

TdApi.AuthorizationStateClosing - The user is closing the session with the server. TDLib is closing, all subsequent queries will be answered with the error 500. Note that closing TDLib can take a while. All resources will be freed only after authorizationStateClosed has been received.

Logging Out

TdApi.AuthorizationStateLoggingOut - The user is currently logging out.

Ready

TdApi.AuthorizationStateReady - The user is authorized and ready to use the application. The user has been successfully authorized. TDLib is now ready to answer queries. That means only after receiving this state you can call TdApi Functions via client.send() or client.execute() methods.

Wait Code

TdApi.AuthorizationStateWaitCode - The user is waiting for the authentication code to be delivered via existing Mobile or Desktop Client. TDLib needs the user's authentication code to authorize.

Property

  • codeInfo : TdApi.AuthenticationCodeInfo - Information about the authorization code that was sent.

TdApi.AuthenticationCodeInfo

Wait Email Address

TdApi.AuthorizationStateWaitEmailAddress - TDLib needs the user's email address to authorize. Call TdApi.setAuthenticationEmailAddress to provide the email address, or directly call TdApi.checkAuthenticationEmailCode with Apple ID/Google ID token if allowed.

Properties

  • allowAppleId : Boolean - True, if authorization through Apple ID is allowed.
  • allowGoogleId : Boolean - True, if authorization through Google ID is allowed.

Wait Email Code

TdApi.AuthorizationStateWaitEmailCode - TDLib needs the user's authentication code sent to an email address to authorize. Call checkAuthenticationEmailCode to provide the code.

Properties

  • allowAppleId : Boolean - True, if authorization through Apple ID is allowed.
  • allowGoogleId : Boolean - True, if authorization through Google ID is allowed.
  • codeInfo : TdApi.EmailAddressAuthenticationCodeInfo - Information about the sent authentication code.
  • nextPhoneNumberAuthorizationDate : Int - Point in time (Unix timestamp) when the user will be able to authorize with a code sent to the user's phone number; 0 if unknown

TdApi.EmailAddressAuthenticationCodeInfo

Wait Other Device Confirmation

TdApi.AuthorizationStateWaitOtherDeviceConfirmation - The user is waiting for confirmation from another device. The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link.

Property

  • link : String - A tg:// URL for the QR code. The link will be updated frequently.

Wait Password

TdApi.AuthorizationStateWaitPassword - The user is waiting for the user's password to be entered. The user has been authorized, but needs to enter a 2-step verification password to start using the application.

Properties

  • passwordHint : String - Hint for the password; may be empty.
  • hasRecoveryEmailAddress : Boolean - True, if a recovery email address has been set up.
  • recoveryEmailAddressPattern : String - Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent.

Wait Phone Number

TdApi.AuthorizationStateWaitPhoneNumber - The user is waiting for the phone number to be confirmed. TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication, or checkAuthenticationBotToken for other authentication options.

Wait Registration

TdApi.AuthorizationStateWaitRegistration - The user is waiting for registration to be completed. The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration.

Wait Td Lib Parameters

AuthorizationStateWaitTdlibParameters - Initializetion parameters are needed. Call setTdlibParameters to provide them.

Example

val authorizationState: TdApi.AuthorizationState = TdApi.UpdateAuthorizationState.authorizationState
when (authorizationState) {
    is TdApi.AuthorizationStateWaitCode -> println("Waiting for the user to enter the authentication code.")
    is TdApi.AuthorizationStateReady -> println("The user is authorized.")
    else -> println("Unexpected authorization state: $authorizationState")
}

Reference

Reference for subclasses