/// <inheritdoc /> public async Task <bool> VerifyToken(string userCode, string deviceName) { var token = await _httpContextAccessor.HttpContext.GetTokenAsync("access_token"); try { var verificationResult = await client.VerifySoftwareTokenAsync(new VerifySoftwareTokenRequest { UserCode = userCode, AccessToken = token, FriendlyDeviceName = deviceName }); if (verificationResult.Status.Value == "SUCCESS") { await client.SetUserMFAPreferenceAsync(new SetUserMFAPreferenceRequest() { AccessToken = token, SoftwareTokenMfaSettings = new SoftwareTokenMfaSettingsType() { Enabled = true, PreferredMfa = true } }); return(true); } } catch (CodeMismatchException) { } catch (EnableSoftwareTokenMFAException) { } return(false); }