skip to Main Content

I started using TLSharp in C# for Telegram. When I’m authenticating the user with this function:

public async Task AuthUser()
{
   var store = new FileSessionStore();
   var client = new TelegramClient(store, "session");

   await client.Connect();

   var hash = await client.SendCodeRequest(NumberToAuthenticate);
   var code = "123"; // you can change code in debugger

   var user = await client.MakeAuth(NumberToAuthenticate, hash, code);

   Assert.IsNotNull(user);
}

On SendCodeRequest to my phone number I get the PHONE_MIGRATE_4 error. How could I fix that?

Telegram website for this error says that I need to switch my data centre. How can I do this in TLsharp?

2

Answers


  1. I haven’t used the TLSharp but according to its documentation you need to update the data centre address in TLSharp.Core.Network.TcpTransport.cs, a file provided by TLSharp library.

    According to its [documentation][1]:

    I get an error MIGRATE_X?
    
    You should change the telegram server address to X. X server address you can get from InitResponse or from Server addresses list. Address should be changed in `TLSharp.Core.Network.TcpTransport.cs`
    
    Server addresses:
    
        Server 1: 149.154.175.50:443
        Server 2: 149.154.167.51:443
        Server 3: 149.154.175.100:443
        Server 4: 149.154.167.91:443
        Server 5: 91.108.56.165:443
    

    Default server address used in TLSharp.Core.Network.TcpTransport.cs is 91.108.56.165 ie server 5.
    [1]: https://github.com/sochix/TLSharp#i-get-an-error-migrate_x

    Login or Signup to reply.
  2. When you send help.getNearestDC, you should get the proper DC to use.

    You will get MIGRATE_X if the number you are trying to authenticate is on a different DataCenter than the one you are currently using.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search