public ActionResult Verify(Otp otp) { if (ModelState.IsValid != true) { return View(); } var response = (AuthResponse)Session[oktaResponseKey]; var factor = response.Embedded.Factors.First(); ViewBag.FactorType = factor.FactorType; var answer = new MfaAnswer(); answer.Passcode = otp.passCode; // TODO: Modify "response" to get the _links for the .factors attribute, then pass the factor from factors to Verify() try { var rv = okta.authn.Verify(response.StateToken, factor, answer); return CreateSessionFor(rv); } catch (OktaException e) { ModelState.AddModelError("*", e.ErrorSummary); } return View(); }
public AuthResponse Verify(string stateToken, Factor factor, MfaAnswer answer = null) { // This is "Href" and not "First()" because this is a "Factor Links Object" var verifyLink = factor.Links["verify"].Href; return Execute(stateToken, verifyLink, answer); }