public async Task TriggerVerifyCode() { IInstaApi api = await GetApi(); await api.LoginAsync(); await api.ChooseVerifyMethod(0); }
public async Task SendVerifyCode(string code) { IInstaApi api = await GetApi(); await api.LoginAsync(); await api.GetVerifyStep(); await api.ChooseVerifyMethod(0); await api.GetVerifyStep(); IResult <InstaResetChallenge> result = await api.SendVerifyCode(code); if (!result.Succeeded) { throw new OdkServiceException(result.Info.Message); } }
private async void B_SendCode_Click(object sender, EventArgs e) { if (api == null) { return; } try { // Note: every request to this endpoint is limited to 60 seconds b_SendCode.Enabled = false; timerTime.Interval = 1000; timerTime.Tick += timer_Tick; if (radioMail.Checked) { IResult <InstaResetChallenge> email = null; IResult <InstaResetChallenge> povtor = null; if (reset) { povtor = await api.ResetChallenge(); } else { email = await api.ChooseVerifyMethod(1); reset = true; } timerTime.Start(); if (email != null) { if (email.Succeeded) { MessageBox.Show($"We sent verify code to this email:\n{email.Value.StepData.Email}"); } else { MessageBox.Show(email.Info.Message, "ERR"); } } } else { IResult <InstaResetChallenge> phoneNumber = null; IResult <InstaResetChallenge> povtor = null; if (reset) { povtor = await api.ResetChallenge(); } else { phoneNumber = await api.ChooseVerifyMethod(0); } timerTime.Start(); if (phoneNumber != null) { if (phoneNumber.Succeeded) { if (phoneNumber.Value.StepData.PhoneNumber != null) { MessageBox.Show( $"We sent verify code to this phone number(it's end with this):\n{phoneNumber.Value.StepData.PhoneNumber}"); } } else { MessageBox.Show(phoneNumber.Info.Message, "ERR"); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "ERR"); //ex.PrintException("ChallengeSendCodeButtonClick"); } }