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
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]:
Default server address used in
TLSharp.Core.Network.TcpTransport.cs
is91.108.56.165
ieserver 5
.[1]: https://github.com/sochix/TLSharp#i-get-an-error-migrate_x
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.