From d019470c81fb7e192acbaaa89eb3eb355c97ba80 Mon Sep 17 00:00:00 2001
From: GitHub Action SESSION_PASSWORD_NEEDED
RPC error, directly asking the user to enter the 2FA password, without sending any authorization code.
Otherwise, the system will send an authorization code using the following logic:
auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;
+codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true logout_tokens:flags.6?Vector<bytes> token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings;
+
+auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;
auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
@@ -68,24 +70,18 @@ If any of the logout tokens matches the account we're trying to login into and t
auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int next_phone_login_date:flags.2?int = auth.SentCodeType;
auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType;
auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType;
-auth.sentCodeTypeFirebaseSms#e57b1432 flags:# nonce:flags.0?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType;
-The system will automatically choose how to send the authorization code; there are multiple possible ways the code can arrive, signaled to the client via the auth.SentCodeType constructor returned by auth.sendCode:
-
-- auth.sentCodeTypeSetUpEmailRequired: if the user logins often enough, Telegram will ask the user to verify an email that will be used to send the login code.
-See here » for more info on the verification process.
-- auth.sentCodeTypeFragmentSms: the code was sent via fragment.com: open the specified
url
to log into fragment.com with your wallet and view the code. The fragment_prefixes
client configuration parameter contains a list of phone number prefixes for anonymous Fragment usernames.
-- auth.sentCodeTypeFirebaseSms:
-- auth.sentCodeTypeEmailCode: the code was sent to the configured login email.
-- auth.sentCodeTypeApp: the code was sent as a Telegram service notification to all other logged-in sessions.
-- auth.sentCodeTypeSms: the code was sent via SMS.
-- auth.sentCodeTypeCall: the user will receive a phone call and a synthesized voice will tell the user the verification code to input.
-- auth.sentCodeTypeFlashCall: the code will be sent via a flash phone call, that will be closed immediately.
-In this case, the phone code will then be the phone number itself, just make sure that the phone number matches the specified pattern (see auth.sentCodeTypeFlashCall).
-- auth.sentCodeTypeMissedCall: the code will be sent via a flash phone call, that will be closed immediately.
-The last digits of the phone number that calls are the code that must be entered manually by the user.
-- Logout tokens »: auth.sendCode will directly return a
SESSION_PASSWORD_NEEDED
RPC error, directly asking the user to enter the 2FA password, without sending any authorization code.
-
-The auth.sendCode method also has parameters for enabling/disabling use of flash calls and missed calls, and allows passing an SMS token that will be included in the sent SMS.
+auth.sentCodeTypeFirebaseSms#e57b1432 flags:# nonce:flags.0?bytes receipt:flags.1?string push_timeout:flags.1?int length:int = auth.SentCodeType;
+
+auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
+auth.sentCodeSuccess#2390fe44 authorization:auth.Authorization = auth.SentCode;
+
+---functions---
+
+auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
+auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;
+
+auth.requestFirebaseSms#89464b50 flags:# phone_number:string phone_code_hash:string safety_net_token:flags.0?string ios_push_secret:flags.1?string = Bool;
+The auth.sendCode method has parameters for enabling/disabling use of flash calls and missed calls, and allows passing an SMS token that will be included in the sent SMS. For example, the latter is required in newer versions of android, to use the android SMS receiver APIs.
The returned auth.SentCode object will contain multiple parameters:
phone_code_hash | string | -Phone code hash, to be stored and later re-used with auth.signIn | +Phone code hash, to be stored and re-used in later method calls |
next_type | @@ -117,6 +113,27 @@ For example, the latter is required in newer versions of android, to use the
The system will automatically choose how to send the authorization code; there are multiple possible ways the code can arrive, signaled to the client via the type
field of the auth.SentCodeType constructor:
url
to log into fragment.com with your wallet and view the code. The fragment_prefixes
client configuration parameter contains a list of phone number prefixes for anonymous Fragment usernames.allow_firebase
flag is set. safety_net_token
, along with the phone_number
and the phone_code_hash
.next_type
authentication method must be used, with auth.resendCode.receipt
and push_timeout
fields of auth.sentCodeTypeFirebaseSms are populated, SESSION_PASSWORD_NEEDED
RPC error, directly asking the user to enter the 2FA password, without sending any authorization code. If the message takes too long (timeout
seconds) to arrive at the phone, the auth.resendCode method may be invoked to resend a code of type next_type
.
If the same happens again, you can use auth.resendCode with the next_type
returned by the previous call to auth.resendCode.
To cancel the verification code use auth.cancelCode.