public async Task <ActionResult> start([FromBody] PhoneVerificationRequestModel verificationRequest) { HttpContext.Session.Set <PhoneVerificationRequestModel>("phone_verification_request", verificationRequest); if (ModelState.IsValid) { string result; if (verificationRequest.via == Verification.SMS) { result = await authy.phoneVerificationRequestAsync( verificationRequest.CountryCode, verificationRequest.PhoneNumber ); } else { result = await authy.phoneVerificationCallRequestAsync( verificationRequest.CountryCode, verificationRequest.PhoneNumber ); } return(Ok(result)); } else { return(BadRequest(ModelState)); } }
public async Task <ActionResult> Start(PhoneVerificationRequestModel verificationRequest) { string sessionStr = JsonConvert.SerializeObject(verificationRequest); HttpContext.Session.SetString(_2faVerificationModelSessionName, sessionStr); if (ModelState.IsValid) { string result; result = await authy.phoneVerificationRequestAsync( verificationRequest.CountryCode, verificationRequest.PhoneNumber ); return(RedirectToAction("Verification", "PhoneVerification")); } else { return(BadRequest(ModelState)); } }