/// <summary> /// Send Two Factor Token /// </summary> /// <param name="user">The User.</param> /// <param name="token">The token.</param> /// <returns>SendResult</returns> public async Task <SendResult> SendTwoFactorTokenAsync(IApplicationUser user, string token) { try { var messageResource = await MessageResource.CreateAsync( new PhoneNumber(user.PhoneNumber), from : new PhoneNumber(_twilioOptions.FromPhoneNumber), body : string.Format(_twilioOptions.TwoFactorTokenBodyFormat, token) ); return(messageResource.ErrorCode.HasValue ? SendResult.Failed(messageResource) : SendResult.Success); } catch (ApiException exception) { return(SendResult.Failed(exception)); } }