public ActionResult Enroll(Otp otp, string factorType) { if (ModelState.IsValid != true) { return View(); } var response = (AuthResponse)Session[oktaResponseKey]; var stateToken = response.StateToken; response = okta.authn.GetStatus(stateToken); try { var rv = okta.authn.ActivateTotpFactor(stateToken, response, otp.passCode); return CreateSessionFor(rv); } catch { return View(); } }
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(); }