Closed stanleyG123 closed 5 years ago
Unless you are using a bot account, you need to enter authentication code to be able to use Telegram. Authentication code is usually sent by SMS, but server may choose other ways to verify your phone number and deliver authentication code to the user. See AuthenticationCodeType documentation for more details about the method by which an authentication code can be delivered to the user.
Thank you Aleksey, Just to confirm , there is no way to get "pre-authorised" and use the key for follow on sessions ?
I'm trying to use TDlib in server side code and getting SMS re-authorization won't work for me. How do other libraries such as Telethon and Python libraries do it? They all probably come in through bot APIs.
There is no way to get "pre-authorized key", but the session is saved automatically as in any other client, so you need to authorize only once.
Does it time out after some time or inactivity ? Where can I learn more about this ?
thanks again for your time !
The account will be automatically deleted after 6 months of inactivity by default.
"...but the session is saved automatically as in any other client..." Are you talking about sqlite .session files? I built a quick test with Telethon ( Python) and it saves .session files so I can restart my program several times
When I try the java example, the sequence is the same : 1. AuthorizationStateWaitTdlibParameters , 2.AuthorizationStateWaitEncryptionKey 3. AuthorizationStateWaitPhoneNumber
I am ok doing it once and storing a key in some cache and then reusing for the duration of the session like it is in Telethon.
I apologize if asking dumb questions , and thank you for your time.
See https://core.telegram.org/tdlib/getting-started#user-authorization for user authorization workflow documentation. All session data is saved by TDLib automatically in database_directory
provided by the application.
thanks !!
There is a checkAuthenticationBotToken
function for this: https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1check_authentication_bot_token.html
@nonlinear-chaos-order-etc-etal The method is for bots only. Ordinary users can't log in without having a phone number.
Looks like the authorization flow requires a phone number and an SMS. Is there a way to get authorized without an SMS on each session? Perhaps by providing an API key of some sort?
thanks !!