OpenTl / OpenTl.ClientApi

The Api client library that implements the MtProto 2.0. To connect to servers, such as Telegram
MIT License
80 stars 22 forks source link

OpenTl.ClientApi.MtProto.Exceptions.PhoneNumberUnoccupiedException #37

Closed ahvahsky2008 closed 5 years ago

ahvahsky2008 commented 5 years ago

  | Имя | Значение | Тип
-- | -- | -- | --
◢ | $exception | {OpenTl.ClientApi.MtProto.Exceptions.PhoneNumberUnoccupiedException: Exception of type 'OpenTl.ClientApi.MtProto.Exceptions.PhoneNumberUnoccupiedException' was thrown.    at OpenTl.ClientApi.MtProto.Services.RequestSenderService.SendRequestAsync[TResult](IRequest`1 request, CancellationToken cancellationToken)    at OpenTl.ClientApi.Services.AuthService.SignInAsync(String phoneNumber, ISentCode sentCode, String code, CancellationToken cancellationToken)    at ConsoleApp6.Program.MainAsync(String[] args)    at ConsoleApp6.Program.Main(String[] args)} | OpenTl.ClientApi.MtProto.Exceptions.PhoneNumberUnoccupiedException
var settings = new FactorySettings
            {
                AppHash = "83a3cxxxxc47a6624",// e.g 456a6654ad8f52c54bc4542505884cad
                AppId = 41279, // e.g 12345
                ServerAddress = "149.154.167.40", // e.g 149.154.167.50
                ServerPublicKey = File.ReadAllText("cert.txt"),// e.g -----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAwVACPi9w23mF3tBk...
                ServerPort = 443,// e.g 443
                SessionTag = "session", // by defaut
                Properties = new ApplicationProperties
                {
                    AppVersion = "1.0.0", // You can leave as in the example
                    DeviceModel = "PC", // You can leave as in the example
                    LangCode = "en", // You can leave as in the example
                    LangPack = "tdesktop", // You can leave as in the example
                    SystemLangCode = "en", // You can leave as in the example
                    SystemVersion = "Win 10 Pro" // You can leave as in the example
                }
            };

            // Create the client
            var clientApi = await ClientFactory.BuildClientAsync(settings).ConfigureAwait(false);

            // If the user is not authenticated
            if (!clientApi.AuthService.CurrentUserId.HasValue)
            {
                // Auth
                var phone = "+792855xxxxx"; // User phone number with plus
                var sentCode = await clientApi.AuthService.SendCodeAsync(phone).ConfigureAwait(false);
                var asasd = 2;

                var code = "27602"; // Sent code

                TUser user;
                try
                {
                    user = await clientApi.AuthService.SignInAsync(phone, sentCode, code).ConfigureAwait(false); // Вот тут ломается
                }
vik-borisov commented 5 years ago

@ahvahsky2008 Hello! PhoneNumberUnoccupiedException means that this phone number is not registered in the current DC. This is not an error in the library))

ahvahsky2008 commented 5 years ago

Блин) а как обойти то? Я ведь есть в телеге на этом номере