public async Task <IActionResult> CallUserAsync(CancellationToken token) { var t = TempData.Peek(PhoneCallTime); if (t == null) { TempData[PhoneCallTime] = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture); return(Ok()); } if (User.Identity.IsAuthenticated) { _logger.Error("Set User Phone number User is already sign in"); return(Unauthorized()); } var user = await _signInManager.GetTwoFactorAuthenticationUserAsync(); if (user == null) { ModelState.AddModelError(string.Empty, _smsLocalizer["CannotResendSms"]); return(BadRequest(ModelState)); } TempData[PhoneCallTime] = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture); await _client.SendPhoneAsync(user, token); return(Ok()); }