public JsonResult VerifyOtp(string msgId, string recieveotp) { OtpModel otp = _otpContext.GetOtp(msgId); if (otp != null) { double diff2 = (DateTime.UtcNow - otp.CreatedAt).TotalMinutes; if (diff2 < 10) { if (otp.Otp == recieveotp) { UserViewModel user = _userContext.GetUserByMsgId(msgId); string token = GenerateJSONWebToken(user); return(Json(new { status = true, accessToken = token, message = "verified" })); } return(Json(new { status = false, message = "Please Enter Valid Otp !!" })); } else { return(Json(new { status = false, message = "Otp Expired" })); } } else { return(new JsonResult(new { status = false, message = "Invalid Request" })); } }