public async Task <IResult <InstaUser> > Verify(string code) { var verifyResult = await _api.SendVerifyCode(code); //verify from sms-online and other... //selen.RemoveInstagramNumber(); var res = await _api.ResetChallenge(); return(await _api.GetUserAsync("_sit.com_")); //TODO: log }
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_Auth_Click(object sender, EventArgs e) { if (api == null) { return; } try { tBox_Code.Text = tBox_Code.Text.Trim(); tBox_Code.Text = tBox_Code.Text.Replace(" ", ""); var regex = new Regex(@"^-*[0-9,\.]+$"); if (!regex.IsMatch(tBox_Code.Text)) { MessageBox.Show("Verification code is numeric!!!", "ERR"); return; } if (tBox_Code.Text.Length != 6) { MessageBox.Show("Verification code must be 6 digits!!!", "ERR"); return; } var verify = await api.SendVerifyCode(tBox_Code.Text); if (verify.Succeeded) { var log = await api.LoginAsync(); if (log.Value == InstaLoginResult.TwoFactorRequired) { MessageBox.Show( "Извините, наше приложение не поддерживает 2-х этапную аутенфикацию. Пожалуйста, отключите её для дальнейшего использования notGram"); return; } if (log.Succeeded) { Close(); } else { MessageBox.Show($"{log.Info.Message}"); } } else { //if (verify.Value == InstaLogin.TwoFactorRequired) //{ // LoginGrid.Visibility = Challenge1Grid.Visibility = Challenge2Grid.Visibility = Visibility.Collapsed; // ChallengeVerificationCodeText.Text = ""; // TwoFactorVerificationCodeText.Text = ""; // Helper.AppName.ChangeAppTitle(); // TwoFactorGrid.Visibility = Visibility.Visible; //} } MessageBox.Show(verify.Info.Message, "ERR"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }