td icon indicating copy to clipboard operation
td copied to clipboard

Java example auth without phone number

Open tashoyan opened this issue 3 months ago • 3 comments

When I run the Java example, it asks for phone number. Then I have to login to my Telegram account using a passcode.

Is it possible to authenticate with app_id and app_hash, without specifying the phone number?

There is a piece of code specifying app_id and app_hash, but it seems unused. The example application always asks for phone number, no matter which app_id and app_hash values I specify.

        switch (Example.authorizationState.getConstructor()) {
            case TdApi.AuthorizationStateWaitTdlibParameters.CONSTRUCTOR:
                TdApi.SetTdlibParameters request = new TdApi.SetTdlibParameters();
                request.databaseDirectory = "tdlib";
                request.useMessageDatabase = true;
                request.useSecretChats = true;
                request.apiId = <...>;
                request.apiHash = <...>;

tashoyan avatar Oct 10 '25 00:10 tashoyan

No, it is not possible to log in to a Telegram account without a phone number.

levlam avatar Oct 10 '25 01:10 levlam

Then what's the use of app_id and app_hash?

tashoyan avatar Oct 10 '25 07:10 tashoyan

They are used to identify the application.

levlam avatar Oct 10 '25 11:10 levlam