How can you make Telegram MTProto IP protocol?

For example, to call / wrap the auth.sentCode method (link below):

https://core.telegram.org/method/auth.sendCode

I tried:

 var url = "https://149.154.167.40"; var data = "(auth.sendCode \"PHONE_CODE+NO\" 0 APP_ID \"SECRET_HASH\" \"en\")"; using (var wc = new WebClient()) { var result = wc.UploadData(url, GetBytes(data)); } 

I get this exception (and internal exception)

The connected connection was closed: An unexpected error occurred sending. (The authentication error failed because the remote side closed the transport stream.)

+8
c # telegram mtproto
source share
3 answers

You start with this SO post

You will need to understand how to create AuthKey first.

The Telegram-API documentation is not well written, but if you continue to study it, you will end up with it.

Working with AuthKey generation will help you create a template and functions that you can then use to solve the rest of the API.

Greetings.

+2
source share

If you try to access https://149.154.167.40 through a web browser, you will see that the https protocol is not enabled. If you look here , there is a list of subdomains that implement https, you can try one of them to make your api request. I'm not sure that the telegram is blocking your request due to the CROSS-ORIGIN policy, because the header access-control-allow-origin:* present in the response. If this does not work, you can implement your own handshake, as the Android application does here . Hope this helps you.

+1
source share

Use TLSharp . To authenticate a user, just run this code

  var hash = await client.SendCodeRequest(phoneNumber); var code = "1234"; //code that you receive from Telegram var user = await client.MakeAuth(phoneNumber, hash, code); 
+1
source share

All Articles