1

is it possible to define how the verification code will be sent when calling the LoginUserIfNeeded method? I need to send it via SMS and not to the application.

1 Answers1

1

Telegram servers decide by themselves through which method to send the code initially.

However if the user did not receive the code (eventually after a given timeout), he can request the code to be sent through an alternative method:

In WTelegramClient, this is done by returning an empty string for "verification_code" (typically, only on the first try)

You should probably first check through which medium Telegram sent the code:
The client.OnOther event receives a Auth_SentCode object specifying details (type) about the transmitted verification code. Then you can decide to reply the empty string only if it was transmitted through a medium you don't have access to.

You can check via the Auth_SentCode.next_type field which method will be used to send the code on the next try. (and you can possibly reply an empty verification_code again to try yet another method)

Additionally, on the call to LoginUserIfNeeded you can pass a CodeSettings instance which offer some limited options about the enabled methods for sending of the code.

Wizou
  • 1,336
  • 13
  • 24